iosobjective-cpush-notificationapple-push-notificationsurbanairship.com

How to register device token for Urban Airship SDK latest versions?


In the older versions of SDK we can register device token using below SDK delegate methods.

- (void)application:(UIApplication *)application 
      didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    UALOG(@"APN device token: %@", deviceToken);
   // Updates the device token and registers the token with UA
   [[UAirship shared] registerDeviceToken:deviceToken];
}

But in the latest versions above delegate methods are removed so how to register device token in the latest SDK versions(ex:UrbanAirship-iOS-SDK - 9.0).

Thanks in advance..


Solution

  • If you're not using the Airship SDK's automatic integration you will need to pass the SDK a few things like the device token you mentioned. Those methods for forwarding the details moved in v8.0.0 of the SDK. You access them with the UAAppIntegration class now like this:

    [UAAppIntegration application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
    

    This documentation should be up to date with more details: https://docs.airship.com/platform/ios/advanced/advanced-configuration/?obj-c#automatic-integration