Last active
December 17, 2015 00:49
-
-
Save shanegao/5524067 to your computer and use it in GitHub Desktop.
Apple Push Remote Notification device token (NSData) to NSString
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
| const unsigned *tokenBytes = [deviceToken bytes]; | |
| NSString *hexToken = [NSString stringWithFormat:@"%08x%08x%08x%08x%08x%08x%08x%08x", ntohl(tokenBytes[0]), ntohl(tokenBytes[1]), ntohl(tokenBytes[2]), ntohl(tokenBytes[3]), ntohl(tokenBytes[4]), ntohl(tokenBytes[5]), ntohl(tokenBytes[6]), ntohl(tokenBytes[7])]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment