阅读背景:

收到静默推送通知后,执行几行代码,应用程序在后台运行,ios

来源:互联网 
-(void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary     *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler{
    NSLog(@"PUSH NOTIFICATION %@",userInfo);


    if([userInfo[@"aps"][@"content-available"] intValue] == 1){

        NSLog(@"SILENT PUSH NOTIFICATION");

        //Here I'm inserting a flag value to my DB.

        completionHandler(UIBackgroundFetchResultNewData);

    }
    else{

        NSLog(@" GENERAL PUSH NOTIFICATION ");

        completionHandler(UIBackgroundFetchResultNoData);

    }
}

My silent notification payload is {
        aps =     {
            "content-available" = 1;
            sound = "";
        };
    }
-(void)application:(UIApplication *)application



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: