4

I'm having issues with Urban Airship, specifically for registering users for Rich Push. I have the following code in AppDelegate

//Create Airship options dictionary and add the required UIApplication launchOptions
NSMutableDictionary *takeOffOptions = [NSMutableDictionary dictionary];
[takeOffOptions setValue:launchOptions forKey:UAirshipTakeOffOptionsLaunchOptionsKey];

[UAirship takeOff:takeOffOptions];
[[UAPush shared] resetBadge];

// Register for remote notfications with the UA Library. This call is required.
[[UAPush shared] registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |
                                                     UIRemoteNotificationTypeSound |
                                                     UIRemoteNotificationTypeAlert)];

- (void)application:(UIApplication *)application  didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
// Updates the device token and registers the token with UA.
NSString *myAlias = @"Your Alias";
[UAPush shared].alias = myAlias;    
[[UAPush shared] registerDeviceToken:deviceToken];
}

This allows my code to register the device under Device Tokens, as well as auto-generate a user for Rich Push. However, the alias and device token are not passed into the Rich Push user, which I suspect is not allowing UA to send a rich push down to my device.

What am I missing? I looked through the docs for iOS push and have all the same code. Any help would be appreciated!

Update:

So I've created a user hitting the /api/user API endpoint and brute-forcing the alias/device_token. However, my device is still not getting the rich push. I went to /api/user/user_id and verified that badge > 0, so Urban Airship is attempting to send these rich push. Anyone know why it's getting lost?

LyricalPanda
  • 1,424
  • 14
  • 25

1 Answers1

0

Rich push is pretty poorly documented, in my opinion. I was stumped about this myself and contacted UA support. They referred me to the inboxSample here: https://github.com/urbanairship/ios-library

Studying this sample is a great start to understanding how to implement Rich Push on the iOS side.

I also found the reference docs for the UA classes here: http://docs.urbanairship.com/ios-lib/

Go through each of the UAInbox* classes. Docs are OK (not great).

I wish they had an overview doc for how to implement Rich Push just like they explain how to implement push notifications. It would have saved a lot of time to many developers, I'm sure...

Judd

Juddster
  • 189
  • 1
  • 4