UIApplicationLaunchOptionsRemoteNotificationKey not getting userinfo

前端 未结 2 1214
终归单人心
终归单人心 2020-12-10 06:56

In my current project I have a push notification. When I tap the app icon I want to get the received notification from the launch options object, but it always returns

2条回答
  •  庸人自扰
    2020-12-10 07:24

    When you launch the application from a PUSH NOTIFICATION ACTION, [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] will return you the push notification payload (in dictionary format). When I say push notification action, it means either tapping the push notification from action center or from the push notification alert dialog (Depending on the device settings, push notification delivery mechanism varies).

    If you launch the application by tapping the APP ICON, [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey] always returns nil. Because, it hasn't been launched from any kind of push notification.

提交回复
热议问题