Last active
October 30, 2021 13:55
-
-
Save hashaam/b77f1f1072b3048765eace4a0fdbbd1f to your computer and use it in GitHub Desktop.
Get device token for remote push notifications in Swift
This file contains 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
// https://hashaam.com/2017/07/22/get-device-token-for-remote-push-notifications-in-swift-3/ | |
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) { | |
let tokenParts = deviceToken.map { data -> String in | |
return String(format: "%02.2hhx", data) | |
} | |
let token = tokenParts.joined() | |
// process token | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment