如果我的應用程序被用戶強制退出,iOS會在后臺啟動它嗎?我使用content-available在推送通知上標記。我有fetch和remote-notification UIBackgroundModes啟用。下面是我在AppDelegate.m中使用的實現:- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)
(UIBackgroundFetchResult))completionHandler{
NSLog(@"Remote Notification Recieved");
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = @"Looks like i got a notification - fetch thingy";
[application presentLocalNotificationNow:notification];
completionHandler(UIBackgroundFetchResultNewData);}當應用程序在后臺運行時,它運行得很好。(收到通知后,應用程序就會觸發本地通知,就像上面的代碼應該做的那樣)。然而,當應用程序沒有運行時并收到推送通知。content-available旗子,應用程序未啟動而didRecieveRemoteNotification從來不調用委托方法。WWDC視頻多任務處理有什么新鮮事?(第204號來自WWDC 2013)顯示如下:它表示,當收到推送通知時,應用程序將被“啟動到后臺”。content-available旗子。為什么我的應用程序沒有啟動到后臺呢?所以真正的問題是:iOS會在用戶強制退出應用程序后執行后臺任務嗎?
3 回答

紅糖糍粑
TA貢獻1815條經驗 獲得超6個贊
Wait for <app>.app to be launched manually
application: didReceiveRemoteNotification: fetchCompletionHandler:
- 3 回答
- 0 關注
- 606 瀏覽
添加回答
舉報
0/150
提交
取消