关于设备令牌

时间:2013-09-26 12:18:25

标签: iphone

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

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

1 个答案:

答案 0 :(得分:0)

否则设备令牌不可能返回null。

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


NSLog(@"token :: %@", devicetoken);
}