如果我的應(yīng)用程序被用戶(hù)強(qiáng)制退出,iOS會(huì)在后臺(tái)啟動(dòng)它嗎?我使用content-available在推送通知上標(biāo)記。我有fetch和remote-notification UIBackgroundModes啟用。下面是我在AppDelegate.m中使用的實(shí)現(xiàn):- (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);}當(dāng)應(yīng)用程序在后臺(tái)運(yùn)行時(shí),它運(yùn)行得很好。(收到通知后,應(yīng)用程序就會(huì)觸發(fā)本地通知,就像上面的代碼應(yīng)該做的那樣)。然而,當(dāng)應(yīng)用程序沒(méi)有運(yùn)行時(shí)并收到推送通知。content-available旗子,應(yīng)用程序未啟動(dòng)而didRecieveRemoteNotification從來(lái)不調(diào)用委托方法。WWDC視頻多任務(wù)處理有什么新鮮事?(第204號(hào)來(lái)自WWDC 2013)顯示如下:它表示,當(dāng)收到推送通知時(shí),應(yīng)用程序?qū)⒈弧皢?dòng)到后臺(tái)”。content-available旗子。為什么我的應(yīng)用程序沒(méi)有啟動(dòng)到后臺(tái)呢?所以真正的問(wèn)題是:iOS會(huì)在用戶(hù)強(qiáng)制退出應(yīng)用程序后執(zhí)行后臺(tái)任務(wù)嗎?
3 回答

紅糖糍粑
TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超6個(gè)贊
Wait for <app>.app to be launched manually
application: didReceiveRemoteNotification: fetchCompletionHandler:
- 3 回答
- 0 關(guān)注
- 608 瀏覽
添加回答
舉報(bào)
0/150
提交
取消