Follow

Configuring Push Services with Urban Airship

Pugpig comes with support for using iOS Push Services via Urban Airship. You can use this feature to let the user know when your content updates.

Configuring push support for your app

You will need to have set your app up in the Provisioning Portal, as per the Apple documentation (for example, here). You should ensure that your app is enabled for the Apple Push notification service. For testing, it must be enabled for development. When you submit your app, it must be enabled for production too. You will also need to set your app up on Urban Airship. This document helps describe the entire process.

Note: it's important to observe the order you create items in the iOS Developer Portal. If you require Push Notification services, the certificates for this should always be created before the Provisioning Profiles. If you create them afterwards you will need to regenerate the provisioning profiles to ensure they contain the Push Notification entitlements.

Adding push to Pugpig

You don't need to worry about adding any client code to Pugpig - the required stubs will be built in when you generate your app using the Xcode template. All you will need to do is add the correct Urban Airship keys to your app and ensure that you build it with the correct push-enabled provisioning profile.

The init function of your AppDelegate.m file contains the required configuration information. You should see code similar to this:

  // TODO: Fill in the app key and secret provided by Urban Airship for push notifications.
  NSURL *appURL = [NSURL URLWithString:@"https://go.urbanairship.com/api/device_tokens"];  
  NSString *appKey = @"";
  NSString *appSecret = @"";
  self.pushManager = [[[KGPushNotificationManager alloc] initWithURL:appURL appKey:appKey appSecret:appSecret] autorelease];

You must set appKey and appSecret. Go to your application on Urban Airship and look in Settings > API keys. You will see an “Application Key” field. The appKey string should be set to this value. You will also see a “Application Secret” field; this goes in the appSecret variable. You should not include the Application Master Secret field in your application. This is generally used for server-side verification.

At this point, you should be able to run your app and see the device register with Urban Airship (it will appear on the “Push” tab, under “Device Tokens”. To test pushing, ensure the app is completely shut down on the iPad and use Urban Airship's “Test Push Notifications” service.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk