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!

I have very similar crash reports. Those issues started appearing with iOS 16.1

It’s likely that these hangs are caused by a problem in the OS itself. If you’re able to reproduce this, please trigger a sysdiagnose log and then file a bug with that log attached. And I’d appreciate you posting your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

NSUserDefaults watchdog crash
 
 
Q