Remeber [NSThead sleepForTimeInterval:N] N don't too heavy and keep the value between 2~5.
And your app now can stay background by press Home key.(I have tried 1.5 days still can press Home back to application)
-(void)applicationDidEnterBackground
{
UIApplication *app = [UIApplication sharedApplication];
UIBackgroundTaskIdentifier taskID;
taskID = [app beginBackgroundTaskWithExpirationHandler:^{
[app endBackgroundTask:taskID];
}];
if (taskID == UIBackgroundTaskInvalid) {
return;
}
[NSThread sleepForTimeInterval:5];
[app endBackgroundTask:taskID];
}
沒有留言:
張貼留言