Hello,
Our used cases is VoIP calling.
There are multiple answers available on internet on how a device token should be parsed.
We are using following technique to parse device token, let us know if there is an Apple Recommended way of parsing device token -
Also, it would be nice if apple provides a toString method to get string out of the device token raw bytes.
Our used cases is VoIP calling.
There are multiple answers available on internet on how a device token should be parsed.
We are using following technique to parse device token, let us know if there is an Apple Recommended way of parsing device token -
Code Block objc + (NSString *)deviceTokenWithData:(NSData *)data { if (![data isKindOfClass:[NSData class]] !([data length] > 0)) { TVOLogError(@"Invalid device token"); return nil; } const char *tokenBytes = (const char *)[data bytes]; NSMutableString *deviceTokenString = [NSMutableString string]; for (NSUInteger i = 0; i < [data length]; i) { [deviceTokenString appendFormat:@"%02.2hhx", tokenBytes[i]]; } return deviceTokenString; }
Also, it would be nice if apple provides a toString method to get string out of the device token raw bytes.