I'm trying to get a device token.
First of all, is this unique value?
I recognize it as a unique value and try to get it. And I was following the way to get a device token when I saw an error.
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let chars = UnsafePointer<CChar>((deviceToken as NSData).bytes) // get Error
var token = ""
for i in 0..<deviceToken.count {
token += String(format: "%02.2hhx", arguments: [chars[i]])
}
print("Registration succeeded!")
print("Token: ", token)
}
Error is Cannot convert value of type 'UnsafeRawPointer' to expected argument type 'RawPointer'
How can I remove this error?
And
- is this a value that won't change if you reinstall the app?