我收到了3个推送通知,内容相同。 一开始,我认为我收到了重复推送通知。我可以撤销deviceToken吗?
但我发现这个推送通知是由不同的deviceToken发送的。
当我重新安装Xcode的应用程序时,可能会出现错误,所以APNS没有成功撤销deviceToken。
我的服务器存储了所有deviceToken并通过这些设备推送通知,并且APNS中有一些deviceToken将指向我的iPhone,因此我收到了很多通知。
如果我是对的,我可以撤销其他deviceToken吗? 还是由其他原因造成的?
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{
// Register for Push Notitications, if running iOS 8
if ([application respondsToSelector:@selector(registerUserNotificationSettings:)]) {
UIUserNotificationType userNotificationTypes = (UIUserNotificationTypeAlert |
UIUserNotificationTypeBadge |
UIUserNotificationTypeSound);
UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:userNotificationTypes categories:nil];
[application registerUserNotificationSettings:settings];
[application registerForRemoteNotifications];
} else {
// Register for Push Notifications before iOS 8
[application registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeAlert |
UIRemoteNotificationTypeSound)];
}
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
//send deviceToken to server
NSLog(@"Token is: %@", deviceToken);
}
您是否有多个版本的应用程序在您的iPhone上安装了不同的捆绑ID? –
可能是服务器端存储了你的设备令牌n次?检查它.. –
Paradeep,不,我不知道。 Kishorem,好吧,我会检查它 – jim