I use NSUserDefaults to save some data locally. But the problem is it doesn't save the data all the times.
For instance:
While an app is crashing I save the execption related informations using NSUserDefaults
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
NSSetUncaughtExceptionHandler(&onUncaughtException);
}
void onUncaughtException(NSException* exception)
{
//save exception related details using NSuserdefaults
}
The problem is that you have to
synchronize
thneNSUserDefaults
while crashing.Since you are not doing that, the exception details disappearCall the
synchronize
method on app termination: