iphoneiospush-notificationapple-push-notificationsurbanairship.com

What's the minimum set of files needed for integrating Urbanairship in to my iOS app?


I am looking to integrate my iOS app with Urbanairship. What are the required files that I need to include from the zip they provide here?

http://com.urbanairship.filereleases.s3.amazonaws.com/libUAirship-latest.zip

I just want the push notification part, nothing else for the time being. The zip contains a lot of files and their documentation is not very clear. If I don't want to run any of their sample, is it enough if I just linclude the .a lib file and uAirship.h file?

Do I need the files from their UI/Default directory? The README file included in the zip seems to indicate that I need to include all the files in the ui/default folder but I am not convinced I need all that.


Solution

  • The first thing you need is the library. The static library libUAirship-1.4.0.a is sufficient for simple push stuff. There's also the libUAirshipFull-1.4.0a, which I'm assuming includes some of the UI elements (but I never used it).

    In terms of the headers, I manually included the UAirship.h file, but it seems like I didn't even need to do that. Just unzip the Airship folder (from the libUAirship-latest.zip file) into your projects directory and point to it in your Header Search Paths build settings. Onces the xcode project knows to search in that Airship folder, it should be able to find all the necessary headers. The easiest way to figure out what path is correct is to just double click on the Header Search Paths row and drag your Airship folder in. Then onces it's in, double check that it's set to recursive.

    Header Search Paths screenshot

    After that, make sure the correct libraries are included and the AirshipConfig.plist file is properly set up (see the link below). And wherever you need to make calls to libUAirship classes, just include the proper headers. So in my AppDelegate.m I have:

    #import "UAirship.h"
    #import "UAPush.h"
    

    Additionally, I did not include the UI stuff. You can use the rest of the library in a very simple (non-interactive manner). Or you can write your own UI code to handle the interaction with the library. If you don't want to bother writing UI code but want to offer the feature, you can add the entire UI folder into your code (which offers a settings page for the user to update their notification preferences, a notification inbox page, etc). I never did any of that stuff.