iOS 9.2应用程序在后台运行,但是当我收到remoteNotification时,didReceiveRemoteNotification不会执行

时间:2016-02-15 11:22:10

标签: ios

这两个API不会被称为

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

    [self handleRemoteNotifications:userInfo];

    [APService handleRemoteNotification:userInfo];
}

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

    [self handleRemoteNotifications:userInfo];

    [APService handleRemoteNotification:userInfo];
    completionHandler(UIBackgroundFetchResultNewData);
}

1 个答案:

答案 0 :(得分:0)

似乎应用程序暂停或被杀死,因为它在连接到Mac时可以正常工作。

您可能希望在后台模式中添加远程通知功能,以允许iOS唤醒应用。此外,如果应用程序在之前的觉醒期间消耗过多的电量,iOS可能会延迟唤醒应用程序。

https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/BackgroundExecution/BackgroundExecution.html