我使用 beginBackgroundTaskWithExpirationHandler:^{ } 设置了一个后台任务,甚至在使用结束任务之后
if ([[UIDevice currentDevice] isMultitaskingSupported]) {
[[UIApplication sharedApplication] endBackgroundTask:backgroundTaskID];
backgroundTaskID = UIBackgroundTaskInvalid;
}
NSLog(@"App State -- %d", [[UIApplication sharedApplication] applicationState]);
if([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
{
//OpenGL operations
}
我得到的是 UIApplicationStateActive。这是一个错误吗?我如何确定该应用程序确实在后台?