Skip to content

Instantly share code, notes, and snippets.

@KanshuYokoo
Created January 25, 2020 14:57
Show Gist options
  • Save KanshuYokoo/975f9fd73e749aadc0e38c20949402c8 to your computer and use it in GitHub Desktop.
Save KanshuYokoo/975f9fd73e749aadc0e38c20949402c8 to your computer and use it in GitHub Desktop.
ios device token: obective-c
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {
NSUInteger dataLength = deviceToken.length;
const unsigned char *dataBuffer = (const unsigned char *)deviceToken.bytes;
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)];
for (int i = 0; i < dataLength; ++i) {
[hexString appendFormat:@"%02x", dataBuffer[i]];
}
let token = [hexString copy];
//continue writing code .....
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment