Skip to content

ujwalshrestha/AFUrbanAirshipClient

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

AFUrbanAirshipClient

An API Client for Registering and Unregistering Devices with Urban Airship

Urban Airship is a popular mobile service provider of push notifications, in-app purchases, and Newsstand publications. Although they provide a static library, it includes a lot of things that most people don't need (weighing in at an astounding 12MB), and is not the easiest thing in the world to use.

AFUrbanAirshipClient is a small, simple client to the Urban Airship API that uses AFNetworking to perform the essential tasks of registering and unregistering devices for push notifications.

Usage

AppDelegate.m

- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge];

    ...
}

- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
    AFUrbanAirshipClient *client = [[AFUrbanAirshipClient alloc] initWithApplicationKey:kUrbanAirshipApplicationKey applicationSecret:kUrbanAirshipApplicationSecret];
    [client registerDeviceToken:deviceToken withAlias:nil success:^(id responseObject) {
        NSLog(@"Success: %@", responseObject);
    } failure:^(NSError *error) {
        NSLog(@"Error: %@", error);
    }];
}

Default Values

If -registerDeviceToken:withAlias:badge:tags:timezone:quietTimeStart:quietTimeEnd:success:failure: scares you as much as it does me, you'll probably want to stick with -registerDeviceToken:withAlias:success:failure:, which provides the following default values:

  • tags:
    • Application Bundle Version (e.g. v1.0)
    • Operating System (e.g. iOS 6.0)
    • Current Locale Identifier (e.g. en_US)
    • Device Model (e.g. iPhone)
  • tz: The current timezone
  • badge: 0
  • quiettime: nil

If you're the enterprising type, or just happen to have the registration payload ready to go, you can always use -registerDeviceToken:withPayload:success:failure:.

Contact

Follow AFNetworking on Twitter (@AFNetworking)

Creators

Mattt Thompson
@mattt

License

AFUrbanAirshipClient is available under the MIT license. See the LICENSE file for more info.

About

An API Client for Registering and Unregistering Devices with Urban Airship

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Objective-C 100.0%