- - (void)applicationDidEnterBackground:(UIApplication *)application {
- UIDevice * device = [UIDevice currentDevice];
- BOOL backgroundSupported = NO;
- if ([device respondsToSelector:@selector(isMultitaskingSupported)]) {
- backgroundSupported = device.multitaskingSupported;
- }
- __block UIBackgroundTaskIdentifier backgroundTask;
- if (backgroundSupported) {
- backgroundTask = [application beginBackgroundTaskWithExpirationHandler:^{
- [application endBackgroundTask:backgroundTask];
- backgroundTask = UIBackgroundTaskInvalid;
- }];
- }
- }
转载于:https://www.cnblogs.com/zsw-1993/archive/2013/04/02/4880231.html