Last active
September 21, 2015 14:10
-
-
Save crsantos/e033887c70fe6c17d81a to your computer and use it in GitHub Desktop.
APNS deviceToken - 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
// based on http://stackoverflow.com/a/29075908/468868 answer | |
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