是否有可能设备 token 第一次为空?我已经删除了空格 设备 token ,但它仍然会在数据库中显示为空。
deviceTokenStr =[[[[deviceToken description]
stringByReplacingOccurrencesOfString: @"<" withString: @""]
stringByReplacingOccurrencesOfString: @">" withString: @""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"device token------------%@",deviceTokenStr);
devicetk=[deviceTokenStr retain];
NSLog(@"My token is: %@", deviceTokenStr);
最佳答案
不,设备 token 不可能返回 null。
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
NSString *devicetoken = [[[[devToken description]
stringByReplacingOccurrencesOfString:@"<"withString:@""]
stringByReplacingOccurrencesOfString:@">" withString:@""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"token :: %@", devicetoken);
}
关于iphone - 关于设备 token ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19028060/