Multiple push registrations for device

When registering for push notifications it seems that every time my app launches it registers a new device ID for the same device token. This causes multiple of the same push notification to appear. This doesn’t happen to me when I build locally but once I start testing with TestFlight all my users experience this problem. Is there anyway to check if a device is registered before trying to register it again?

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    backendless.initApp(APP_ID, secret: SECRET_KEY, version: VERSION_NUMBER)
    backendless.messaging.registerForRemoteNotifications()
    return true



}


func application(application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData) {
		backendless.messaging.didRegisterForRemoteNotificationsWithDeviceToken(deviceToken)
	}
	
    func application(application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: NSError) {
		backendless.messaging.didFailToRegisterForRemoteNotificationsWithError(error)
    }
    
    func application(application: UIApplication, didReceiveRemoteNotification userInfo: [NSObject : AnyObject]) {
		backendless.messaging.didReceiveRemoteNotification(userInfo)






















    }

Hi Nathan,

Device ID will change only if application is uninstalled and then re-install on the device. Is this what’s happening in your case?

To see if the device is registered, you could us this API:
https://backendless.com/documentation/messaging/ios/messaging_retrieve_device_registration.htm

Regards,
Mark

No this is happening every time the app is launched. Is it necessary to check if the device is registered before calling didRegisterForRemoteNotificationsWithDeviceToken? I’ve attached a screen shot of what I’m seeing in my device table.

How long ago did you get the library? We updated the mechanism for generating device id about 3 weeks ago. This is what it does now:

The call uses the following iOS api:
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDevice_Class/#//apple_ref/occ/instp/UIDevice/identifierForVendor

The doc says the following:

The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution.

Does any of this apply to your scenario?

Regards,
Mark

It looks like I had just missed this update. I updated the libraries and everything seems to be working normally now. Thanks for the assistance!