Ich benutze PushNotification für meine App. Es scheint, dass das Geräte-Token jedes Mal generiert wird, wenn die Anwendung geladen wird. Also auf meinem Server habe ich viele doppelte Geräte Token.iPhone PushNotification Mehrere Male registrieren
Muss ich das Geräte-Token überprüfen, bevor ich es zur Datenbank hinzufüge, oder mache ich etwas falsch mit der Implementierung in der App?
Unter dem Code Segment, das ich verwende.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// launchOptions has the incoming notification if we're being launched after the user tapped "view"
NSLog(@"didFinishLaunchingWithOptions:%@", launchOptions);
// [self.viewController handleDidReceiveRemoteNotification:userInfo];
// other setup tasks here....
[[UIApplication sharedApplication]
registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
UIRemoteNotificationTypeSound |
UIRemoteNotificationTypeAlert)];
// [self updateWithRemoteData]; // freshen your app!
// RESET THE BADGE COUNT
application.applicationIconBadgeNumber = 0;
// ...
// call the original applicationDidFinishLaunching method to handle the basic view setup tasks
[self applicationDidFinishLaunching:application];
return YES;
}
- (void)application:(UIApplication *)app
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken {
[self sendDeviceTokenToRemote:devToken]; // send the token to your server
}
Könnte jemand helfen? Wie kann ich eindeutige Geräte-Tokens auf meinem Server speichern?
Dank, Nikil
danke yar es ist sehr nützlich für mich. – nambi