I am checking:
[[UIDevice currentDevice] systemName]
in applicationDidEnterBackground. It is causing a EXC_BAD_ACCESS (SIGSEGV) signal. The stack trace shows that this is occurring internally in UIDevice, which is calling CFDictionaryGetValue.
Experimenting, calling:
CFDictionaryGetValue(NULL, "key");
results in the same error.
Any ideas? I have searched for documentation about accessing UIDevice while in the background and found nothing to indicate it should be a problem.
Thanks
Calling (and logging) [[UIDevice currentDevice] systemName] in applicationDidEnterBackground: works fine in my test. CFDictionaryGetValue(NULL, "key") will always crash, and has nothing to do with the problem you've encountered.
- (void)applicationDidEnterBackground:(UIApplication *)application
{
NSString *systemName = [[UIDevice currentDevice] systemName];
if ( systemName )
NSLog(@"%@", systemName);
else
NSLog(@"null systemName");
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.