更新时间:2023-11-24 19:12:10
您需要通过点击通知托盘中的推送通知来打开应用程序.
从图标启动应用程序时,launchOptions将为nil.从推送通知中启动将为您提供launchOptions.
https://developer.apple.com/reference/uikit/uiapplicationdelegate/1622921-应用程序
I'm face the problem after upgraded to iOS 10 about push notification (I am using Swift3).
In normal case when application open or application still in background everything work as well (can receive push notification and update data as my logic).
But when application is terminated i can't handle push notification when application become active.
Here is my test case.
After that application start and didFinishLaunchingWithOptions being called but launchOptions aways null so i can't handle push notification (But if i open application from notification in notification center or popup notification launchOptions is not null)
Does anybody has any idea to check this problem ?
Thank you in advance.
You need to open the application by tapping the push notification in the notification tray.
When you launch the application from the icon, launchOptions will be nil. Launching from the push notification will provide you launchOptions.
https://developer.apple.com/reference/uikit/uiapplicationdelegate/1622921-application