一点提示,为了将收到的令牌转换为适合用javapns注册的格式,此代码可以解决问题:
- (NSString *)convertTokenToDeviceID:(NSData *)token {NSMutableString *deviceID = [NSMutableString string];// iterate through the bytes and convert to hexunsigned char *ptr = (unsigned char *)[token bytes];for (NSInteger i=0; i < 32; ++i) { [deviceID appendString:[NSString stringWithFormat:@"%02x", ptr[i]]];}return deviceID;
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)