1

アプリケーションにプッシュ通知データを保存したいですが、ユーザーがマルチタスクビューアでアプリケーションをスワイプしてアプリケーションを終了した場合、データを保存できません。状態).Iは、アプリケーションを使用:didReceiveRemoteNotification:fetchCompletionHandler:まだ私はこのアプリケーション:didReceiveRemoteNotification:fetchCompletionHandler:iOS 9が呼び出されていない

enter image description here

enter image description here

などのアプリの設定を設定しているプッシュ通知データに

を保存することができませんでしたit.Butを処理するために、

とペイロード、

{ 
    "aps" : { 
     "alert" = "Notification with custom payload", 
    }, 
    "content-available" = 1 
} 

とアプリケーション:didReceiveRemoteNotification:fetchCompletionHandlerは:これは完全に正常であるこの

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

    if(application.applicationState == UIApplicationStateInactive) { 

     NSLog(@"Inactive"); 

     //Show the view with the content of the push 

     completionHandler(UIBackgroundFetchResultNewData); 

    } else if (application.applicationState == UIApplicationStateBackground) { 

     NSLog(@"Background"); 

     NSString *info = [[userInfo valueForKey:@"aps"]valueForKey:@"alert"]; 

     completionHandler(UIBackgroundFetchResultNewData); 

    } else { 

     NSLog(@"Active"); 

     //Show an in-app banner 

     completionHandler(UIBackgroundFetchResultNewData); 

    } 
} 
+0

@Ewan Mellor、@ Anbu.Karthik .Ok。教えてください。アプリが停止状態のときにプッシュ通知データを保存する方法はありますか? – PramukaD

答えて

0

のように見えます。デバイスのコンソールログを確認すると、ユーザーによって終了されたためにアプリケーションを起動させないというメッセージがシステムから表示されます。

+0

問題はアプリケーションと呼ばれていませんでした:didReceiveRemoteNotification:アプリケーションがサスペンド状態または実行中でない状態の場合、fetchCompletionHandler通知が受信されたときにアプリケーションが開かないようにします。 – PramukaD

+0

Appleのドキュメントは明確です。あなたは設計され、意図された動作を見ている。他に何ができるのか知りたいのであれば、別の質問をする必要があります。警告:その質問も既に尋ねられ、答えられています。 – Avi

+0

それを知っているのではなく、その質問へのリンクを投稿している可能性があります。@Avi –

関連する問題