PushWizard – ShiVa Engine

PushWizard

Nav Gupta: “PushWizard.com is a Push Notification Service for Developers of Mobile Applications. There is a very high demand for Push Notifications in the Mobile Sector, but for most developers it is very resource and time consuming, therefor very cost intensive to develop and maintain such a service on their own.”

New App on iTunes Developer Site

Before you can use APNS (Apple Push Notification Service) properly, I recommend to create a basic app, even though this is not necessary.
– Log into http://itunesconnect.apple.com
– Click on Manage Your Applications
– Click on the “Add New App” button
– Follow the steps and add a new app

APNS – Developer Mode Setup

– Go to http://developer.apple.com and click on Member Center to log in
– Click on the iOS Provisioning Portal icon
– Click on App Ids
– Go down the list of apps and find the new app. It should be in the form com.yourcompany.yourapp.
– Click on the “CONFIGURE” link next to it in the Action column.
NOTE: If you do not see your app ID there, simply click on “New App ID” at the top and follow the steps to make the same bundle ID as you did in Step 1 above. USE THE EXACT SAME BUNDLE ID! After it is created, then find it in the list and click on the Configure link.
– Go down the page and make sure to check the checkbox next to “Enable for Apple Push Notification service”

APNS – Developer Mode Provisioning Setup

APNS works with provisioning profiles that are NOT wildcard provisions. For example, a provisioning profile for com.gamescorpion.- WILL NOT work with APNS where as com.gamescorpion.intimatefireplace WILL work with APNS. In order to guarantee a successful setup, I recommend doing each step outlined and creating new provisioning profiles SPECIFICALLY for your app, in both Developer mode to test and Distribution mode when releasing your app live.
– Launch the Keychain app on 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
– Continuing on from Step 2 above on the Apple Developer Portal, click on the “Configure” button next to “Development Push SSL Certificate”
– If this is your first time or you are still developing, configure the “Development Push SSL Certificate”. Later when you are going to go LIVE, 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.
NOTE: 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.
– 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 (.p12 file extension)
– For the password field, enter a password. You will enter this password twice.
– Enter your Password (your actual Mac login password).
– Save this file. We will now use this file when we set up our app on PushWizard.com
– Now go back to the Apple Developer Portal and create a NEW provisioning profile for DEVELOPMENT. When you go LIVE, you will have to do this step again, creating a DISTRIBUTION provisioning profile for the specific app.
– Click on Provisioning
– Click on the Development Tab. When going live, you would click on the Distribution Tab.
– Click on New Profile button
– Enter your app name, select the App ID you made earlier, Check off the Certificates box, select all devices and click on Submit.
– Refresh the page and download the new provisions. You simply double click on the downloaded files and they will install in xCode.
– When signing your app, use these new provisioning profiles to sign or your push notifications will not work otherwise!
NOTE: You may have to restart xCode for the new provisions to take effect.

PushWizard.com Setup

– Go to http://www.pushwizard.com and log into your account.
– Click on the ADD button after logging in, in order to add a new app to your PushWizard account.
– Setup a SANDBOX mode pushwizard app. When you have tested everything, you would choose “LIVE Application” and repeat all the steps the same way.
– Use any generic number for your iTunes ID during testing, however when going live, you need to use your actual app ID.
Example: https://itunes.apple.com/us/app/my-clock-station-pro/idub548580935/b/u?ls=1&mt=8 <---- YOUR APP ID IN THIS CASE IS 548580935 (The 9 digit number) - Name your app - You may also want to upload an app icon - Now we upload the .p12 file we created above. - Enter the password you had put in for the .p12 file above, and hit the Save button - Once saved successfully, you will see an App Key listed on the newly generated App. NOTE DOWN this long App ID as it will be used later to connect your push notifications.

xCode Setup

NOTE: ShiVa Users, simply compile your app using the UAT and get into xCode. We will assume that you are already in xCode at this point.
– Go to PushWizard.com again and click on the Downloads link at the top
– Click on the iPhone SDK and download it to your hard drive
– Unzip the files there and note down the location
– Open the folder where you downloaded the PushWizard code and click and drag PushWizard.h and libPushWizard.a into your project’s Classes folder.
– When the copy option box pops up, make sure you CHECK OFF “Copy items into destination group’s folder (if needed)”. Also make sure that the “Add to targets” box with your app name is checked off. Click on Finish
– Open your AppDelegate.m file (ShiVa 3D Users click on the S3DEngine_AppDelegate.m file).
– Under the imports section, add another import as follows:

#import "PushWizard.h"

– Under the imports, write the following code:

static NSString *kAppKey = @"YOUR_PUSHWIZARD_KEY_HERE";

– Scroll down to the applicationDidFinishLaunching function and paste the following code inside near the top:

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

– Scroll down to the applicationWillTerminate function and place the following code:

    // PushWizard Terminate Code
    [PushWizard endSession];

– We need to add 2 functions to the bottom of the same AppDelegate.m file. Outside of any function and before the very last function, paste the following 2 functions:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken
{
   NSArray *arr = [[NSArray alloc] initWithObjects:@"value1", @"value2", @"value3", @"value4", @"value5", nil];
   [PushWizard startWithToken:deviceToken andAppKey:kAppKey andValues:arr];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
{
   // Necessary for handling special events, like URL Redirecting and Review Requests
   [PushWizard handleNotification:userInfo];
}

– Save the file.
– Click on info_phone.plist in the Resources folder
– Make sure all bundle identifiers and other parts match your app details
– Click on the Project on top
– In the Build Settings tab, go down to Code Signing and select the Code Signing Identity of the new provisioning profile you downloaded.
– Build and Run the app (only build when you are going live).
– To test the app, simply run the app on your PHYSICAL DEVICE as Push notifications do not work on the simulator.

Testing

– Go to PushWizard.com and select your app from the list
– Click on the “New Push Message” tab
– Fill in your message details and hit the SEND button
– If successful, you should see the push message show up on your device.




Need more answers?

  • slackBanner