Skip to content

Instantly share code, notes, and snippets.

@shanegao
Last active December 17, 2015 00:49
Show Gist options
  • Select an option

  • Save shanegao/5524067 to your computer and use it in GitHub Desktop.

Select an option

Save shanegao/5524067 to your computer and use it in GitHub Desktop.
Apple Push Remote Notification device token (NSData) to NSString
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