swift5获取remoteNotification

记一下笔记:

1
2
3
4
5
6
let userInfo = launchOptions?[UIApplication.LaunchOptionsKey.remoteNotification] as? [AnyHashable: Any]
if userInfo != nil {
JPUSHService.handleRemoteNotification(userInfo)
let notification = NSNotification.Name(rawValue: "jpush")
NotificationCenter.default.post(name: notification, object: nil, userInfo: userInfo)
}

来源:https://stackoverflow.com/questions/40209234/how-to-handle-launch-options-in-swift-3-when-a-notification-is-tapped-getting-s