Created
September 13, 2019 19:49
-
-
Save Bucimis/21b0258d65827a83cf20d4d8f030a9f6 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { | |
NSString *tokenString; | |
if (@available(iOS 13.0, *)) { | |
NSUInteger dataLength = deviceToken.length; | |
if (dataLength == 0) { | |
return; | |
} | |
const unsigned char *dataBuffer = deviceToken.bytes; | |
NSMutableString *hexString = [NSMutableString stringWithCapacity:(dataLength * 2)]; | |
for (int i = 0; i < dataLength; ++i) { | |
[hexString appendFormat:@"%02x", dataBuffer[i]]; | |
} | |
tokenString = [hexString copy]; | |
} else { | |
tokenString = [NSString stringWithFormat:@"%@", deviceToken]; | |
} | |
[[Appboy sharedInstance] registerPushToken:tokenString]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment