Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler { //处理远程通知——应用正在运行
- if(application.applicationState == UIApplicationStateInactive) {
- //用户点击通知中心的通知或报警弹窗
- [self processRemoteNotification:userInfo];
- } else if(application.applicationState == UIApplicationStateBackground) {
- //应用在后台,不存在用户交互——只是获取数据 } else {
- //应用已经处于激活状态——显示应用内的更新 }
- }
- -(void)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- id notification = [launchOptions
- objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey];
- if(notification != nil) {
- NSDictionary *userInfo = (NSDictionary *)notification; [self processRemoteNotification:userInfo];
- }
- }
- -(void)processRemoteNotification:(NSDictionary *)userInfo { }
Add Comment
Please, Sign In to add comment