判断应用程序在前台还是后台

应用程序不管在后台还是前台都会执行

- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo
fetchCompletionHandler:(void
(^)(UIBackgroundFetchResult))completionHandler

 

判断应用程序在前台还是后台

[UIApplication sharedApplication].applicationState == UIApplicationStateActive

这是在前台
UIApplicationStateActive

//这是在后台
UIApplicationStateBackground 

 

posted @ 2016-01-13 12:48  我叫南部21号  阅读(232)  评论(0编辑  收藏  举报