2016-02-15 34 views
0

這兩個API則不會調用的iOS 9.2應用程序在後臺運行,但是當我收到remoteNotification

- (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

我運行的應用程序與Mac連接,它的工作well.but當我沒有連接我的Mac上運行。我發現這個問題 –

回答

0

看來,應用程序被暫停didReceiveRemoteNotification不執行或者因爲連接到Mac時工作而死亡。

您可能想要在後臺模式中添加遠程通知功能,以允許iOS喚醒應用程序。另外,如果應用程序在以前的喚醒過程中消耗太多的電量,iOS可能會延遲喚醒應用程序。

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

+0

與iOS 9.2或iOS 9.0無關,其他因素導致它,謝謝 –

相關問題