3

设备令牌第一次是否可能为空?我已经从设备令牌中删除了空格,但它仍然会在数据库中显示为空。

 deviceTokenStr =[[[[deviceToken description]
                        stringByReplacingOccurrencesOfString: @"<" withString: @""]
                       stringByReplacingOccurrencesOfString: @">" withString: @""]
                      stringByReplacingOccurrencesOfString: @" " withString: @""];
   NSLog(@"device token------------%@",deviceTokenStr);
 devicetk=[deviceTokenStr retain];
NSLog(@"My token is: %@", deviceTokenStr);
4

1 回答 1

0

不,设备令牌不可能返回 null。

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken
{
NSString *devicetoken = [[[[devToken description]
                 stringByReplacingOccurrencesOfString:@"<"withString:@""]
                stringByReplacingOccurrencesOfString:@">" withString:@""]
               stringByReplacingOccurrencesOfString: @" " withString: @""];


NSLog(@"token :: %@", devicetoken);
}
于 2013-09-26T12:24:23.187 回答