Created
July 22, 2018 05:33
-
-
Save sunnyy02/fa41fa49fdbc86e969431e2442fd7f10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
// Override point for customization after application launch. | |
let notificationTypes: UIUserNotificationType = [UIUserNotificationType.alert, UIUserNotificationType.badge, UIUserNotificationType.sound] | |
let pushNotificationSettings = UIUserNotificationSettings(types: notificationTypes, categories: nil) | |
application.registerUserNotificationSettings(pushNotificationSettings) | |
application.registerForRemoteNotifications() | |
return true | |
} | |
func application(_: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | |
let tokenString = deviceToken.reduce("", {$0 + String(format: "%02X", $1)}) | |
print("deviceToken: \(tokenString)") | |
} | |
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) { | |
print(error) | |
} | |
private func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) { | |
print(userInfo) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment