你需要在你的AppDelegate调用此获得令牌:
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge |UIRemoteNotificationTypeSound)];
和
- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Prepare the Device Token for Registration (remove spaces and < >)
NSString* devToken = [[[[deviceToken description]
stringByReplacingOccurrencesOfString:@"<"withString:@""]
stringByReplacingOccurrencesOfString:@">" withString:@""]
stringByReplacingOccurrencesOfString: @" " withString: @""];
NSLog(@"devToken=%@",devToken);
}
令牌是这样的:
bbb4231be5df46d6e9c1e4c3418ad56456c671eb7101818d8cc9ac80445727a8
ESP。您的令牌中尾随的“=”看起来可疑。
编辑您的令牌后,看起来像设备ID。这不一样。 – Thorsten