In my app,there are some watchdog crashes,the triggered stack is -[NSUserDefaults(NSUserDefaults) setObject:forKey:] + 84 (NSUserDefaults.m:228) my code is like this :
static bool nbsAppIsFirstLaunch() { static bool flag = false; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @try { NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults]; NSString *ver = @"***"; [userDefault setObject:ver forKey:@"xxxx"]; [userDefault synchronize]; flag = true; } @catch (NSException *exception) { } }); return flag; }
from the crash stack ,I think the ' [userDefault setObject:ver forKey:@"xxxx"];' is the problem calls,but I don't know why.
Any help may appreciated!