Possible Duplicate:
Why does clearing NSUserDefaults cause EXC_CRASH later when creating a UIWebView?
**Hi all, I have a FAQ screen in the app and this is webview, this webpage has as "Email Me" link in it. When clicked on this this navigates to Mail Composer. But app still runs in the background. Now click back the minimized app and click the same FAQ link, app crashes. This only happens in iOS 5.1 . Below are the logs which are received :
-[__NSCFDictionary setObject:forKey:]: attempt to insert nil value (key: WebKitLocalStorageDatabasePathPreferenceKey)
I have used the below code in "APPDelegate" file
NSDictionary *settings = [[NSUserDefaults standardUserDefaults] dictionaryRepresentation];
NSArray *keys = [settings allKeys];
for (int i=0; i<[keys count]; i++)
{
NSString *key = [keys objectAtIndex:i];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
}
[[NSUserDefaults standardUserDefaults] synchronize];