PushWoosh – ShiVa Engine

PushWoosh

Nav Gupta: “PushWoosh.com is a service that allows you to incorporate APNs for up to 10 apps with 1,000,000 subscribers for free. For a moderate fee, you can increase the number of apps and subscribers to fit your business model. For this tutorial, we are assuming that you already have your ShiVa project compiled and running in xCode. Reminder: You are going to repeat the App Setup Steps a second time before going LIVE! The first time, you will be going through this procedure only for your Development Device (sandbox).”

PushWoosh Account

– Create a new PushWoosh.com account
– Sign into your new account and you will see a control panel.
– Click on the “Add New” button.
– Select an App Name.
– Upload an App Icon (I have used a size of 512×512 and I tested also with a size of 48×48)

App Setup Steps

We are going to go through the http://www.pushwoosh.com/programming-push-notification/iphone-configuration-guide/
– Launch the keychain in your Mac (Applications->Utilities->Keychain Access)
– In Keychain Access, click on Request a Certificate from a CA (Keychain Access->Certificate Assistant->Request a Certificate From a Certificate Authority)
– In the User Email Address field, use the email you use to log into your Apple Developer Account.
– In the Common Name field, enter your certificate “YOUR APP – Push Notifications DEMO” (without the Quotes). When you are creating the LIVE version, change DEMO to LIVE
– In the CA Email Address, leave it BLANK.
– Click on “Saved to Disk” for the “Request is:” section.
– Save the certificate, for example to your desktop
– Open a browser window and go to http://developer.apple.com/iphone/
– Click on the iOS Provisioning Portal
– Click on App IDs on the left list of menu options
– Now scroll down to see if the app you are looking to put Push Notifications into already exists. If so, then you can skip over the next paragraph and start at “CONFIGURING PUSH NOTIFICATIONS”.

New App ID

– Complete Step 2 (2. Creating an App ID) in the PushWoosh iOS Configuration Guide.

Configuring Push Notifications

– Scroll Down to the App Id of the app and select the “Configure” link.
– If this is your first time and you are still developing, then you would configure the “Development Push SSL Certificate”.
– If you are going to go LIVE, then you would configure the “Production Push SSL Certificate”.
– Click the Configure button and you will see a window pop up.
– Click Continue, then Choose File, then find the CertificateSigningRequest.certSigningRequest file we saved and click Choose.
– Hit the Generate Button.
– After successful APN Certificate generation, hit the Continue button.
– Click the Download button, then hit Done.
– Double Click on the downloaded file and it will install into your keychain.
For Live Certificates: If it does not work, simply delete the previous (development) keys in your keychain, revoke the created Production Push SSL Certificate and redo from step 1 again.
– Keep the downloaded certificate file, as it is the first of two files you need to upload to PushWoosh later!
– You should now see the successfully created keys inside your keychain.
– Click on the Private Key for your app inside the Keychain Access. It should say YOUR APP – Push Noticiations DEMO – or LIVE, depending on which one you are doing.
– Click on File->Export Items
– Save the File as YourApp with a .p12 file extension
– For the password field, use your pushwoosh password you use to login to pushwoosh. You will enter this password twice.
– Enter your Password (your actual Mac login password).
– Go to the PushWoosh control Panel again.
– Select your App inside the Control Panel.
– Click on the Configure button next to the greyed out iOS button in the Users platforms section.
– Click on the Browse button for Certificate and find the certificate file you saved earlier on the desktop (e.g. aps-production.cer).
– Click on the next Browse button for the .p12 file and you should see the YourApp.p12 file on your desktop as well, select that file.
– In the Private key password section, put the password that you entered earlier when setting up the key export.
– Select the Gateway Sandbox – Select Production only when going LIVE.
– You will see an APNS Configured message. iOS should now be GREEN and enabled.

xCode Steps

– Go back to the Push Woosh contol Panel.
– Download the PushWoosh iOS SDK. You can find it under “Personal SDK”.
– Open xCode. Click and drag all the files from the Classes folder into the Classes folder in your xCode project.
– Select the PushNotificationManager_Prefix.pch file in the Finder, it sits in the same zip file just outside of the Classes folder. Click and drag it into the xCode Classes folder as well.
– Go to your S3DEngine_AppDelegate.m file (AppDelegate.m). In the list of imports, add the following import (Approx. line 7):

#import "PushNotificationManager.h"

– Now scroll down to the applicationDidFinishLaunching function (Approx. Line 41) and paste the following code inside near the top of the function:

    // Setup Push Notifications APNs
    [[UIApplication sharedApplication] registerForRemoteNotificationTypes:
    (UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)];

– Now go down below the function where the function ends and copy and paste this new function:

// FOR PUSH NOTIFICATIONS, THIS FUNCTION IS REQUIRED
- (void) onPushAccepted:(PushNotificationManager *)pushManager withNotification:(NSDictionary *)pushNotification {
    NSLog(@"Push notification received");
}

– Save that file and go into our Info_Phone.plist. Add a new line called: Pushwoosh_APPID
Go back to the Control Panel in PushWoosh and select our app and underneath the app name will be the Application code. Copy this code which is in BLUE color and paste it into the Pushwoosh_APPID field you just created in the Info_Phone.plist. Finally build and run your app. You should now be able to test your push notifications successfully!

Testing

To test, simply load your app once, and then go to your pushwoosh control panel for the app, and type in any test message and hit the “Woosh!” button. Your message should be sent and you will receive it within 30 seconds on your device!




Need more answers?

  • slackBanner