Skip to content

Instantly share code, notes, and snippets.

@nickludlam
Created August 16, 2021 08:46
Show Gist options
  • Save nickludlam/4b045826472e3db9ba2adbb9cd56b8e6 to your computer and use it in GitHub Desktop.
Save nickludlam/4b045826472e3db9ba2adbb9cd56b8e6 to your computer and use it in GitHub Desktop.
A small amendment to application:didRegisterForRemoteNotificationsWithDeviceToken: so I can see the deviceToken in hex
- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken
{
NSUInteger dataLength = deviceToken.length;
if (dataLength > 0) {
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]];
}
NSLog(@"APNS Test: deviceToken=%@", hexString);
}
AppController_SendNotificationWithArg(kUnityDidRegisterForRemoteNotificationsWithDeviceToken, deviceToken);
UnitySendDeviceToken(deviceToken);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment