1 - (void)applicationDidEnterBackground:(UIApplication *)application 2 { 3 // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 4 // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 5 UIApplicationState state = [[UIApplication sharedApplication] applicationState]; 6 7 if (state == UIApplicationStateInactive) {//说明是锁屏 8 [self.viewController ImageUploadFailed]; 9 }else if(state == UIApplicationStateBackground){//说明进入后台 10 NSLog(@"background"); 11 } 12 13 }
转载于:https://www.cnblogs.com/ThankForYou/archive/2012/09/14/2685040.html