Created
August 16, 2021 08:46
-
-
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
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
- (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