2016-09-26 9 views

答えて

1

私はそれはあなた

役立つことを願っていますあなたは、IOS 10.0

import 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) 
} 

}

を追加するために行う必要があると思います

関連する問題