Giter VIP home page Giter VIP logo

afurbanairshipclient's Introduction

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.

afurbanairshipclient's People

Contributors

mattt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.