Iphone device token - NSData or NSString

前端 未结 6 1550
走了就别回头了
走了就别回头了 2020-12-13 13:38

I am receiving iPhone device token in the form of NSData object. When I tested my notifications script function, I have only copied that object from log and th

6条回答
  •  鱼传尺愫
    2020-12-13 14:39

    Ok, I found a solution. If anyone has the same problem, forget about ASCII encoding, just make the string with the following lines:

    NSString *deviceToken = [[webDeviceToken description] stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
    deviceToken = [deviceToken stringByReplacingOccurrencesOfString:@" " withString:@""];
    

提交回复
热议问题