0
iOS 10では、ユーザーがプッシュ通知をタップしてアプリを起動したときにdidReceiveRemoteNotificationメソッドが起動しない。 これを修正するには?iOS 10でdidReceiveRemoteNotificationメソッドが起動しない
iOS 10では、ユーザーがプッシュ通知をタップしてアプリを起動したときにdidReceiveRemoteNotificationメソッドが起動しない。 これを修正するには?iOS 10でdidReceiveRemoteNotificationメソッドが起動しない
私はそれはあなた
役立つことを願っていますあなたは、IOS 10.0import UserNotifications
// didFinishLaunchingWithOptions method
if #available(iOS 10.0, *) {
let center = UNUserNotificationCenter.currentNotificationCenter()
center.delegate = self
center.requestAuthorizationWithOptions([.Alert, .Sound, .Badge], completionHandler: { (granted, error) in
// do nothing for now
})
}
が延長に
extension AppDelegate: UNUserNotificationCenterDelegate {
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, didReceiveNotificationResponse response: UNNotificationResponse, withCompletionHandler completionHandler:() -> Void) {
// When app is killed and or in background tapping on this will resut this event
let payload = Payload(dict: response.notification.request.content.userInfo)
triggerThePaylod(payload)
}
}
を追加するために行う必要があると思います