What’s new in AeroGear iOS ?

The 1.2.0 version of aerogear-ios contains only one minor change, the deprecation of thelogin: password: success: failure method.

APNs support

With the August release the entire AeroGear focus was around adding Push Notification. Two servers (seeUnifiedPush Server Blog and SimplePush server blog for more details) have been written and we added support to our client platforms (see here for Android/JS) as well!

For the iOS library that obviously means adding support for the Apple Push Notification Service.

Stay standard!

For receiving APNs push notifications there are no extra APIs introduced. The standard Apple APIs work with the AeroGear UnifiedPush server and the our AeroGear Push SDK. For instance, you can use the existing delegate for receiving remote notifications while the application is running, like:

- (void)application:(UIApplication *)application 
  didReceiveRemoteNotification:(NSDictionary *)userInfo {
    // extract desired value from the dictionary...
}

Device Registration

In order to be able to receive push notifications you need to register the iOS device token with a server. The same is true when using the AeroGear UnifiedPush server. The SDK helps you to perform an easy registration:

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {

  AGDeviceRegistration *registration = 
    [[AGDeviceRegistration alloc] initWithServerURL:
     [NSURL URLWithString:@"http://YOUR_SERVER/ag-push/"]];

  [registration registerWithClientInfo:^(id<AGClientDeviceInformation> clientInfo) {

    // required fields
    [clientInfo setDeviceToken:deviceToken];
    [clientInfo setVariantID:@"YOUR IOS VARIANT ID"];
    [clientInfo setVariantSecret:@"YOUR IOS VARIANT SECRET"];

    // --optional config--
    UIDevice *currentDevice = [UIDevice currentDevice];
    [clientInfo setOperatingSystem:[currentDevice systemName]];
    [clientInfo setOsVersion:[currentDevice systemVersion]];
    [clientInfo setDeviceType: [currentDevice model]];
    } success:^() {
      NSLog(@"PushEE registration worked");
    } failure:^(NSError *error) {
      NSLog(@"PushEE registration Error: %@", error);
  }];
}

All you need is simply providing the URL of the UnifiedPush server, the deviceToken, the variantIDand the variantSecret.

In the UnifiedPush server when you create an iOS Variant for a PushApplication, the AdminUI does provide the information about the variantID and the variantSecret:

Xcode Template

Our AeroGear Xcode Template has been updated and supports the new Push SDK as well:

Tutorial

Getting started with the APNs is hard, especially with setting up all the Apple related things, like certificates or provisioning profiles. We have create a tutorial that explains the entire workflow, of using the AeroGear UnifiedPush server and the iOS SDK, explained with a simplified demo application.

Check it out!

Feedback welcome

Reach out to us on IRC or our mailing list. Bugs and feature requests are always welcome in our JIRA instance.

Enjoy !

About these ads

Howdy!

Posted in aerogear

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 32 other followers

%d bloggers like this: