/pushyExample

Primary LanguageObjective-C

Getting Started - iOS Setup

Step 1- Download the iOS API Sample app

<%= link_to 'Version 1.0', 'https://github.com/logansease/pushyExample' %>

Step 2- Extract and open the sample app

Step 3- Copy Dependant Libraries

Drag and drop the following folders from the sample app into your project

  • ASIHTTP

Step 4- Copy Pushy API Files

Drag and drop the files in the Pushy folder from the sample project.

Step 5- Link Required Frameworks

Add the following frameworks to your project

  • MobileCoreServices
  • CFNetwork
  • libz.dylib
  • SystemConfiguration

Step 6- Set your project up for Push Notifications

Go to the Apple iOS Provisioning Portal, configure your app for Push Notifications and download your push certificates.

Step 7- Convert your certificates

Go to the folder where you saved your certificates in step 6. Run the following commands on both the Development and the Production certificate. Ensure that you name them appropriately. In the commands below, replace aps_push_certificate_DEV with the names of the certificates you saved in step 6. The output file name 'outputName_DEV_cert' can be replaced with any name, just so you can remember which is development and which is production.


  $ openssl x509 -in aps_push_certificate_DEV.cer -inform der
      -out outputName_DEV_cert.pem

$ openssl pkcs12 -nocerts -out outputName_DEV_cert.pem -in outputName_DEV_cert.p12

Step 8- Set up Pushy API App

Register at pushyapi.com. Create a new app.

Copy and paste the contents of the dev/prod .pem files generated in step 7 into the dev / prod certificate fields.

In your project, open PushyNotificationService.h and add the app ID and secret Key for your app.

Step 9- Add Pushy Registration code to your AppDelegate


    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
        ...
        NSLog(@"Registering for push notifications...");
        [[UIApplication sharedApplication]
            registerForRemoteNotificationTypes:
            (UIRemoteNotificationType)
            (UIRemoteNotificationTypeBadge |
            UIRemoteNotificationTypeSound |
            UIRemoteNotificationTypeAlert)];
    }
    - (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
        NSString *str = [NSString stringWithFormat:@"Device Token=%@",deviceToken];
        [[PushNotificationService sharedService] saveNewDevice:deviceToken];
    }
    

You're ready to go!

Getting Started - Use it

Log into PushyAPI.com

Select your App, and press 'Push Notifications'.

Here you can view how many devices have registered to receive push notifications from within your app.

Press on 'Send notification', and fill out a simple form with the Info you'd like in your Notification and press send.

That's it!

All users of your app that have registered will receive the push notification to their device. It's that easy!