Push notification data not getting when app launched directly by clicking app icon

后端 未结 4 1498
攒了一身酷
攒了一身酷 2021-02-15 04:09

I have a scenario in which app will get push notification and need to show that messages in home screen of my app, for that i saved the message array into user defaults from my

4条回答
  •  没有蜡笔的小新
    2021-02-15 04:54

    Enable "Remote Notifications" under background modes in capabilities in target settings. This will fetch the notification data even when the app is in the background. Also, make sure to implement:

    -(void)application:(UIApplication *)application 
    didReceiveRemoteNotification:(NSDictionary *)userInfo 
    fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler;
    

    in your app delegate.

提交回复
热议问题