Objective c 当应用程序在后台使用解析时,未接收推送通知
推送通知在应用程序位于后台时未接收。若应用程序位于前台,则其工作正常,若应用程序在收到通知后位于后台,则需要启动某些进程 我的代码是:Objective c 当应用程序在后台使用解析时,未接收推送通知,objective-c,background,parse-platform,xcode6,apple-push-notifications,Objective C,Background,Parse Platform,Xcode6,Apple Push Notifications,推送通知在应用程序位于后台时未接收。若应用程序位于前台,则其工作正常,若应用程序在收到通知后位于后台,则需要启动某些进程 我的代码是: - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo { [PFPush handlePush:userInfo]; if (application.applicationState == UI
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
[PFPush handlePush:userInfo];
if (application.applicationState == UIApplicationStateInactive)
{
NSLog(@" background userInfo =%@",userInfo);
[PFAnalytics trackAppOpenedWithRemoteNotificationPayload:userInfo];
}
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"%@",userInfo);
}
我的环境:
iOS8、Xcode 6.3、Mac10.10。
对于iOS8,您需要使用以下第二种委托方法:
// < iOS7
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
// >= iOS7
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult))completionHandler
/ =iOS7
-(void)application:(UIApplication*)application didReceiveMemotentification:(NSDictionary*)userInfo fetchCompletionHandler:(void(^)(UIBackgroundFetchResult))completionHandler