Post

Replies

Boosts

Views

Activity

NSUserDefaults watchdog crash
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! 2022-06-05_04-57-01.2982_+0800-6639500cec222811adc83dad86209cb18a5105ae.crash 2022-06-05_08-27-30.3546_+0800-108efb0d1bbf81d7681a43641f83ab0343600b3a.crash 2022-06-05_11-58-47.1630_+0800-3a3544e962567df9668c7fd4e7916b8721ae9221.crash
2
0
1.1k
Jun ’22