blog
blog copied to clipboard
How to get notification userInfo at launch
When user taps on push notification, depending on app state
Checking UIScene.ConnectionOptions.notificationResponse?.notification.request.content.userInfo
in scene(_:willConnectTo:options:)
- app terminated: sometimes nil
- app in background: notification info
Checking UNNotificationResponse.notification.request.content.userInfo
in userNotificationCenter(_:didReceive:withCompletionHandler:)
- app terminated: notification info
- app in background: notification info
Read more
- https://stackoverflow.com/questions/60007715/launchoptions-always-nil-when-launching-from-a-push-notification
- https://stackoverflow.com/questions/42989932/difference-between-unusernotificationcenterdelegate-and-didreceiveremotenotifica