EasyPush Push Notifications Extension for ios Copyright 2012 Milkman Games, LLC. All rights reserved. http://www.milkmangames.com For support, contact info@milkmangames.com To View full AS3 documentation, see 'docs/as3docs/index.html'. Review 'example/easypushexample.as' for a sample application. This extension requires the AIR 3.3 SDK or higher, which you can get at http://www.adobe.com/special/products/air/sdk/. 1. Configure Your App in itunes Connect Before you can use Push Notifications on ios, you'll need to create a new App ID specifically for your Push- Enabled App, and create a special provisioning profile for your app, and back-end certificate for the server. Create a New App ID 1. Log in to https://developer.apple.com and select ios Dev Center. 2. In the right-hand column, select ios Provisiong Portal. 3. Choose 'App IDs' from the menu, then 'New App ID'. 4. For 'Description', enter a description for your app. This will be used to easily identify the App within the Provisioning Portal, but won t be shown to users. For 'Bundle Seed ID', select 'Use Team ID'. For Bundle Identifier, enter the ID for your app, such as 'com.yourcompany.pushapp'. Take note of this ID as you will have to use later in your AIR Application Descriptor file. 5. Press Submit to Submit the new App ID. 6. When you create your App In itunes Connect before publishing to the App Store, be sure to
choose this App ID so Push Notifications will be abled for production. 7. Back on the App IDs list, scroll down and locate the ID you just created. Choose the 'Configure' option. Enable Push and Generate Certificates Push Notifications require a special SSL Certificate that allows a back-end server to manage notifications for your app. Development and Production each get their own certificate. You may use these certificates with a service such as Urban Airship so you won't have to run your own servers. 8. Enable the Check Box for 'Enable for App Push Notification Service'. 9. Choose the 'Configure' button next to 'Development Push SSL Certificate'. 10. A prompt will appear to generate a Certificate Signing Request. You have already gone through this process when you began development to generate your Adobe AIR singing certificates; you'll need to repeat it now to generate the new Push Notification certificates.
11. Follow the on screen instructions to create the signing request. If you need to generate your Signing Request from Windows, you can follow the instructions provided by Adobe at http://help.adobe.com/en_us/as3/iphone/ws144092a96ffef7cc-371badff126abc17b1f-8000.html. Be sure to give your request a logical name in the name field, such as "MyGame Development Push. 12. Press Continue, and select the Certificate Signing Request File you just created on your computer. Upload it to Apple and choose Generate. A new Certificate file will be generated- download it to your computer, and double click it to install it in the Keychain Access tool. 13. In Keychain Access, select "My Certificates, and locate the new Certficate; it's name should look like 'Apple Development ios Push Services: YOURNEWNAMEHERE. 14. Right-click on the new certificate, and choose "Export. Export the file as a.p12 with a logical file name you'll remember (such as 'MyGameDevPushCert.p12'.) 15. If you want to do this with Windows instead, refer to the instructions for exporting a certficate as a.p12 file provided by Adobe at http://help.adobe.com/en_us/as3/iphone/ws144092a96ffef7cc- 371badff126abc17b1f-7fff.html. 16. Note that you'll want to repeat this process later to generate a 'Production' SSL certificate before publishing your app to the App Store. Create a New Provisioning Profile for Your Push-Enabled Application When using Push Notifications, Apple requires you to generate a separate Provisiong (.mobileprovision) file for each application you want to create. Be sure you've completed the steps above and waited a few minutes before creating your provisioning-profile. 16. In the Provisioning Portal, Select the 'Provisioning' tab from the left-hand side. 17. Choose the 'New Profile' button in the top-right. Under 'Development' click 'New Profile'. 18. For Profile Name, enter a logical name, such as 'MyPushGame Dev Provision'. Click the CheckBox next to 'Certificates'. For App ID, select the New App ID you created in steps 1-6. Submit and save the new.mobileprovision file on your computer. Be sure to give it a logical name so you can recall that is the Dev Provision for your particular push enabled game. 19. You may repeat this steps to create a Distribution Profile, using your Production SSL Key, when you're ready to submit the app to the App Store. 2. Configuring for Use With Urban Airship The EasyPush extension is designed so that it can be quickly and easily integrated with Urban Airship. Urban Airship is a popular provider for back-end services for managing, distributing, and testing push notifications, that offers both free and affordable plans.
1. Sign up for Urban Airship at http://www.urbanairship.com. Signing up and testing are free. Sending up to one million messages per month is free. 2. On the Main Application Page, go down to Add new Application. 3. Enter the Name, Icon, Category, and other metadata for your app. 4. Select 'Push Notifications Support'. 5. Press 'Choose File' for Apple Push certificate, and navigate to the Development SSL certificate you generated in Section 1, 'Enable Push and Generate Certificates' above. For Certificate Password, enter the password you used when exporting the certificate. 6. Take note of your Application Key and Application Secret- you'll need both these values later to set up Urban Airship with Actionscript 3. The most time consuming part is done now let's right some code!
3. Install the AIR 3.3 SDK in your IDE The EasyPush extension requires the AIR 3.3 SDK or higher. You can download the latest AIR SDK from http://www.adobe.com/special/products/air/sdk/. If you haven't already installed the AIR 3.3 SDK for your Flash CS6 or Flash Builder IDE, follow the instructions below: Enabling the AIR 3.3 SDK in Flash Professional CS6: 1. Unzip the AIR 3.3 SDK package to a location on your hard drive. 2. Launch Flash Professional CS6. 3. Select Help > Manage AIR SDK... 4. Press the Plus (+) Button and navigate to the location of the unzipped AIR SDK 5. Press OK 6. Select File > Publish Settings 7. Select the AIR 3.3 SDK for ios from the 'Target' Dropdown menu Enabling the AIR 3.3 SDK in Flash Builder 4.6- Windows: 1. Unzip the AIR 3.3 SDK package to a location on your hard drive. 2. Close Flash Builder. 3. Locate the Flash Builder SDK directory. On the PC, usually c:\program Files\Adobe\Adobe Flash Builder 4.6\sdks. 4. Make a copy of the current Flex SDK directory, and give it a descriptive name. For instance, copy the 4.6.0 SDK folder inside /sdks and name the copy 4.6.0_AIR33. 5. Copy and paste the contents of the AIR 3.3 SDK on top of the 4.6.0_AIR33 directory. Accept all changes. 6. Edit the flex-sdk-description.xml file inside the new directory, and change the value of the <name> tag to 'Flex 4.6.0 (AIR 3.3)'. 7. Open Flash Builder and choose Project > Properties > Flex Compiler > Configure Flex SDKs. 8. Press 'Add' and navigate to the new folder location. Enabling the AIR 3.3 SDK in Flash Builder 4.6- Mac: 1. Copy the contents AIR 3.3 SDK package to a location on your hard drive. 2. Close Flash Builder. 3. Locate the Flash Builder SDK directory. On the Mac, it is usually /Applications/Adobe Flash Builder 4.6/sdks/. On the PC, c:\program Files\Adobe\Adobe Flash Builder 4.6\sdks. 4. Create a new folder inside the SDK folder, called AIR33SDK and copy the contents of the SDK package into it. 5. Open the Terminal, and merge the AIR 3.3 SDK files into your current SDK directory: sudo cp -Rp /Applications/Adobe\ Flash\ Builder\ 4.6/sdks/AIR33SDK/ /Applications/Adobe\ Flash\ Builder\ 4.6/sdks/4.6.0/ 6. Edit the flex-sdk-description.xml file inside the new directory, and change the value of the <name> tag to 'Flex 4.6.0 (AIR 3.3)'. 7. Open Flash Builder and choose Project > Properties > Flex Compiler > Configure Flex SDKs.
8. Press 'Add' and navigate to the new folder location. 4. Include the EasyPush API Library Add the EasyPushAPI.swc (Flash Pro 5.5, Flash Builder 4.5), OR com.milkmangames.nativeextensions.easypush.ane (Flash Builder 4.6, Flash Pro CS6) library to your project. These are in the /extension folder of the extension package zip file. In FlashDevelop: 1. Copy the EasyPushAPI.swc file to your project folder. 2. In the explorer panel, right click the.swc and select Add to Library. 3. IMPORTANT: Right-click the swc file in the explorer, choose Options, and select External Library In Flash Professional CS6: 1. Create a new project of the type 'AIR for ios' 2. Select File > Publish Settings... 3. Select the wrench icon next to 'Script' for 'Actionscript Settings' 4. Select the Library Path tab 5. Press the 'Browse for Native Extension (ANE) File' button and select the com.milkmangames.nativeextensions.easypush.ane file 6. Select File>Publish Settings... 7. For 'Target' Select 'AIR for ios 3.3' In Flash Professional CS5.5: 1. Select File>Publish Settings>Flash>ActionScript 3.0 Settings 2. IMPORTANT: Select External Library Path 3. Click Browse to SWC File 4. Select the EasyPush.swc In Flash Builder 4.6: 1. Go to Project Properties 2. Select Native Extensions 3. Choose Add ANE... and navigate to the com.milkmangames.nativeextensions.easypush.ane file In Flash Builder 4.5: 1. Go to Project Properties 2. Select ActionScript Build Path 3. Select Add Swc 4. IMPORTANT: Navigate to EasyPush.swc and choose External Library type 5. API Quick Start: Initialization and Basic Setup The EasyPush extension can be up and running in a few simple calls. See 'example/easypushexample.as' for a full example.
1. Import the API Classes: import com.milkmangames.nativeextensions.*; import com.milkmangames.nativeextensions.events.*; 2. First, check to make sure that Push Notifications are available and working on the current platform, using the issupported() and arenotificationsavailable() methods. If they return false, you won't be able to use Push Notifications (because the device does not supported, or the user has disabled them.) Otherwise, you can initialize Urban Airship. You should call the init method as the very first thing your code does after the app starts to ensure any messages are properly received. if(easypush.issupported() && EasyPush.areNotificationsAvailable()) { // "YOUR_AIRSHIP_KEY - put your application key from urban airship here // "YOUR_AIRSHIP_SECRET - put the app secret from urban airship here // true sets development mode to ON. Set to false only when publishing for app store. // true enables automatic badge number tracking on the icon (optional) // true will automatically show alert boxes when a push is received. EasyPush.initAirship("YOUR_AIRSHIP_KEY, YOUR_AIRSHIP_SECRET, airship,true,true,true); } else { trace("push is not supported or is turned off... ); return; } 3. The above initairship() call is taking 6 parameters. The first two are your Application Key and Secret, which you can get from the Urban Airship website for your app as described in Section 5. The third string value is reserved for future API use- you can enter any string here. The next 3 boolean parameters are: developmentmode, autobadge, and autoalertbox, in that order. Setting the 4 th parameter to 'true' enables Development mode for your app. You'll want to set this to false when you are ready to publish to the app store. Setting the 5 th parameter, 'autobadge' to true will cause the notification badge number on your app's icon to be controlled automatically by Urban Airship. Setting the 6 th parameter, 'autoalertbox' to true will cause an AlertBox to appear in native UI if the app receives a push while it's running. You can set it to false if you want to handle those messages with your own UI. 4. That's all you need for receiving basic push notifications! 6. Optional: Settings Tags, Quiet Time, and Aliases Urban Airship has a feature that allows you to associate an alias or group of tags with a user. This is useful for targeting push notifications to a specific user or group of users. Setting an Alias You can set a unique Alias that's unique to the user to make them easily identifiable for push notifications. For instance, if you're using the GoViral Extension to log the user in to Facebook, you might want to set their Alias to their Facebook ID, so you can send direct notifications to that particular user: // sets the user's alias to "bob@internet.com. // You'd want to be sure this is unique to your user though! EasyPush.airship.updateAlias("bob@internet.com );
Setting Tags You can set a series of tags to put the user into logical groups, so you can send selective push to them later. // create a vector array of tags var tags:vector.<string>=new Vector.<String>(); tags.push("advanced ); tags.push("gamer ); EasyPush.airship.setAirshipTags(tags); Setting Quiet Time "Quiet Time is a period during which notifications will not be displayed. The following example makes push 'quiet' for the next 15 minutes: //Setting quiet time for next 15 minutes... var now:date=new Date(); var infifteen:date=new Date(); infifteen.settime(now.millisecondsutc+(15*60*1000)); EasyPush.airship.setQuietTime(now,inFifteen); 7. Optional: Handling Push Events Registration Events When the user starts your app, it will attempt to register them for notifications. As a result, either PNAEvent.TOKEN_REGISTERED or PNAEvent.TOKEN_REGISTRATION_FAILED will be dispatched. If registration succeeds, but some of the types of push requested are turned off (for instance, push messages are enabled, but not sounds), the PNAEvent.TYPES_DISABLED event will fire. EasyPush.airship.addEventListener(PNAEvent.TOKEN_REGISTERED,onTokenRegistered); EasyPush.airship.addEventListener(PNAEvent.TOKEN_REGISTRATION_FAILED,onRegFailed); EasyPush.airship.addEventListener(PNAEvent.TYPES_DISABLED,onTokenTypesDisabled); function ontokenregistered(e:pnaevent):void { trace("token was registered: "+e.token); } function onregfailed(e:pnaevent):void { trace("reg failed: "+e.errorid+"="+e.errormsg); } function ontokentypesdisabled(e:pnaevent):void { trace( some types disabled: +e.disabledtypes); } Notification Events There are two scenarios for receiving notifications: Either the app was open, and a push was received (PNAEvent.FOREGROUND_NOTIFICATION), or the app was in the background, and the user clicked the notification to open the app (PNAEvent.RESUMED_FROM_NOTIFICATION.) In the former case, a message box with the notification will automatically be displayed to the user, if autoalertbox was set to 'true' in the initairship() call (see Section 5 for more details.) Also, if the user then presses the 'OK' button this alert, PNAEvent.ALERT_DISMISSED will be dispatched.
These events contain extra information about the notifications that were sent- so you can use that data to perform special actions in your app. EasyPush.airship.addEventListener(PNAEvent.ALERT_DISMISSED,onAlertDismissed); EasyPush.airship.addEventListener(PNAEvent.FOREGROUND_NOTIFICATION,onNotification); EasyPush.airship.addEventListener(PNAEvent.RESUMED_FROM_NOTIFICATION,onNotification); function onnotification(e:pnaevent):void { trace( new notification, type+"="+e.rawpayload+","+e.badgevalue+","+e.title); } function onalertdismissed(e:pnaevent):void { trace( Alert dismissed, payload="+e.rawpayload+","+e.badgevalue+","+e.title); } 8. Update Your Application Descriptor You'll need to be using the AIR 3.3 SDK or higher, and include the extension in your Application Descriptor XML. For an example, see 'example/app.xml'. (Remember, the <id> section must exactly match your itunes Connect id, so you can't copy that part of the example xml verbatim.) 1. Set your AIR SDK to 3.3 in the app descriptor file: <application xmlns="http://ns.adobe.com/air/application/3.3"> 2. Include a link to the extension in the descriptor: <extensions> <extensionid>com.milkmangames.extensions.easypush</extensionid> </extensions> 3. Make sure that your <id> property exactly matches the App ID you created in itunes Connect. 4. For Push Notifications to work, you must add a special 'entitlements' element to the application XML file. Refer back to the App ID you created in Section 1. It has a special name, consisting of a string of random letters and numbers followed by your app bundle ID- for instance it might look like Q942RZTE24.com.yourcompany.yourgame - except with your own special prefix and ID. You need to enter this exact special string into the <iphone> block of your application descriptor, like so: <iphone> <InfoAdditions> <![CDATA[ <key>uidevicefamily</key> <array> <string>1</string> <string>2</string> </array> ]]> </InfoAdditions> <Entitlements> <![CDATA[ <key>application-identifier</key> <string>q942rzte24.com.yourcompany.yourgame</string> <key>aps-environment</key> <string>development</string>
<key>get-task-allow</key> <true/> <key>keychain-access-groups</key> <array> <string>q994rzte24.com.milkmangames.pushexample</string> </array> ]]> </Entitlements> </iphone> Pay careful attention to the parts in bold. Make sure you replace the app ID Strings with your own values, from your itunes Connect App ID. Also, when you build your App Store release, you must change development to production, and remove the entire <key>get-taskallow</key><true/> line. 9. Build the Application When building with the extension, you'll need to specify the directory containing the com.milkmangames.extensions.easypush.ane file. You also MUST use the.mobileprovision file you generated in Section 1. Flash Builder 4.6 - Mac: Flash Builder 4.6 has full support for native extensions. 1. Make sure you've included the ANE file as described in Section 5, 'Include the EasyPush Library.' 2. Make sure that the extension is enabled for your target configuration. 3. Build your application and deploy as usual. Flash CS6 Mac: 1. Make sure you've included the ANE file as described in Section 4, 'Include the EasyPush Library' 2. Build the application as usual. Flash CS6- Windows: Flash CS6 has full support for native extensions. 1. Make sure you've included the.swc file as described in Section 5, 'Include the EasyPush Library.' 2. Compile your ios application as usual. Flash Builder 4.6 - Windows: Flash Builder 4.6 has full support for native extensions. 1. Make sure you've included the ANE file as described in Section 5, 'Include the EasyPush Library.' 2. Make sure that the extension is enabled for your target configuration. 3. Build your application and deploy as usual.
Flash Builder 4.5 - Mac: Flash Builder 4.5 does not have complete native extension integration- but you can still use it to build the.swf file for your app. 1. Make sure you've included the.swc file as described in Section 5, 'Include the EasyPush Library.' 2. Build your app from Flash Builder, and note the location of the generated.swf file. 3. Make sure you've downloaded the AIR 3.3 SDK or higher, and unzip it to a folder on your Mac. For this example, we'll assume you've unzipped it to /Users/yourname/air_sdk_33. 4. Create a directory to store the component files of your application. For this example, we'll assume the directory is /Users/yourname/myapp. 5. Copy the.mobileprovision file,.swf file,.p12 keystore file, application.xml file, and.ane file into your new directory. 6. Open the Terminal, and navigate to the new directory. The following command would navigate to a /Users/yourname/myapp directory: cd /Users/yourname/myapp 7. Use the AIR SDK to compile the final IPA for your device. The following command demonstrates how this is done; replace the paths in red with the correct file names for your application: /Users/yourname/air_sdk_33/bin/adt -package -target ipa-test-interpreter -storetype pkcs12 -keystore YOURKEYSTOREFILE.P12 -storepass YOURPASSWORD -provisioning-profile YOUR_MOBILEPROVISION_FILE.mobileprovision myapp.ipa myapp.xml myapp.swf -extdir. Take note of the dot after -extdir. It is not a typo; it tells the adt packager to look for the extension in the current directory. For building an Android application, use the 'apk' target instead and omit the -provisioning-profile switch. Flash CS5.5 - Mac: Flash CS5.5 does not have complete native extension integration- but you can still use it to build the.swf file for your app. 1. Make sure you've included the.swc file as described in Section 5, 'Include the EasyPush Library.' 2. Build your app from Flash CS5.5, and note the location of the generated.swf file. 3. Make sure you've downloaded the AIR 3.3 SDK or higher, and unzip it to a folder on your Mac. For this example, we'll assume you've unzipped it to /Users/yourname/air_sdk_33. 4. Create a directory to store the component files of your application. For this example, we'll assume the directory is /Users/yourname/myapp. 5. Copy the.mobileprovision file,.swf file,.p12 keystore file, application.xml file, and.ane file into your new directory. 6. Open the Terminal, and navigate to the new directory. The following command would navigate to a /Users/yourname/myapp directory: cd /Users/yourname/myapp 7. Use the AIR SDK to compile the final IPA for your device. The following command demonstrates how this is done; replace the paths in red with the correct file names for your application: /Users/yourname/air_sdk_33/bin/adt -package -target ipa-test-interpreter -storetype pkcs12 -keystore YOURKEYSTOREFILE.P12 -storepass YOURPASSWORD -provisioning-profile YOUR_MOBILEPROVISION_FILE.mobileprovision myapp.ipa myapp.xml myapp.swf -extdir.
Take note of the dot after -extdir. It is not a typo; it tells the adt packager to look for the extension in the current directory. For building an Android application, use the 'apk' target instead and omit the -provisioning-profile switch. Flash Builder 4.5 - Windows: Flash Builder 4.5 does not have complete native extension integration- but you can still use it to build the.swf file for your app. 3. Make sure you've included the.swc file as described in Section 5, 'Include the EasyPush Library.' 4. Build your app from Flash Builder, and note the location of the generated.swf file. 5. Make sure you've downloaded the AIR 3.3 SDK or higher, and unzip it to a folder on your PC. For this example, we'll assume you've unzipped it to c:\dev\air_sdk_33. 6. Create a directory to store the component files of your application. For this example, we'll assume the directory is c:\dev\myapp. 7. Copy the.mobileprovision file,.swf file,.p12 keystore file, application.xml file, and.ane file into your new directory. 8. Open the Command Prompt (Start > Run > 'cmd' [ENTER]), and navigate to the new directory. The following command would navigate to a c:\dev\myapp directory: cd c:\dev\myapp 9. Use the AIR SDK to compile the final IPA for your device. The following command demonstrates how this is done; replace the paths in red with the correct file names for your application: c:\dev\air_sdk_33\bin\adt -package -target ipa-test-interpreter -storetype pkcs12 -keystore YOURKEYSTOREFILE.P12 -storepass YOURPASSWORD -provisioning-profile YOUR_MOBILEPROVISION_FILE.mobileprovision myapp.ipa myapp.xml myapp.swf -extdir. Take note of the dot after -extdir. It is not a typo; it tells the adt packager to look for the extension in the current directory. For building an Android application, use the 'apk' target instead and omit the -provisioning-profile switch. Flash CS5.5 - Windows: Flash CS5.5 does not have complete native extension integration- but you can still use it to build the.swf file for your app. 1. Make sure you've included the.swc file as described in Section 5, 'Include the EasyPush Library.' 2. Build your app from Flash CS5.5, and note the location of the generated.swf file. 3. Make sure you've downloaded the AIR 3.3 SDK or higher, and unzip it to a folder on your PC. For this example, we'll assume you've unzipped it to c:\dev\air_sdk_33. 4. Create a directory to store the component files of your application. For this example, we'll assume the directory is c:\dev\myapp. 5. Copy the.mobileprovision file,.swf file,.p12 keystore file, application.xml file, and.ane file into your new directory. 6. Open the Command Prompt (Start > Run > 'cmd' [ENTER]), and navigate to the new directory. The following command would navigate to a c:\dev\myapp directory: cd c:\dev\myapp 7. Use the AIR SDK to compile the final IPA for your device. The following command demonstrates how
this is done; replace the paths in red with the correct file names for your application: c:\dev\air_sdk_33\bin\adt -package -target ipa-test-interpreter -storetype pkcs12 -keystore YOURKEYSTOREFILE.P12 -storepass YOURPASSWORD -provisioning-profile YOUR_MOBILEPROVISION_FILE.mobileprovision myapp.ipa myapp.xml myapp.swf -extdir. Take note of the dot after -extdir. It is not a typo; it tells the adt packager to look for the extension in the current directory. For building an Android application, use the 'apk' target instead and omit the -provisioning-profile switch. FlashDevelop - Windows: FlashDevelop does not have complete native extension integration- but you can still use it to build the.swf file for your app. 1. Make sure you've included the.swc file as described in Section 5, 'Include the EasyPush Library.' 2. Build your app from FlashDevelop, and note the location of the generated.swf file. 3. Make sure you've downloaded the AIR 3.3 SDK or higher, and unzip it to a folder on your PC. For this example, we'll assume you've unzipped it to c:\dev\air_sdk_33. 4. Create a directory to store the component files of your application. For this example, we'll assume the directory is c:\dev\myapp. 5. Copy the.mobileprovision file,.swf file,.p12 keystore file, application.xml file, and.ane file into your new directory. 6. Open the Command Prompt (Start > Run > 'cmd' [ENTER]), and navigate to the new directory. The following command would navigate to a c:\dev\myapp directory: cd c:\dev\myapp 7. Use the AIR SDK to compile the final IPA for your device. The following command demonstrates how this is done; replace the paths in red with the correct file names for your application: c:\dev\air_sdk_33\bin\adt -package -target ipa-test-interpreter -storetype pkcs12 -keystore YOURKEYSTOREFILE.P12 -storepass YOURPASSWORD -provisioning-profile YOUR_MOBILEPROVISION_FILE.mobileprovision myapp.ipa myapp.xml myapp.swf -extdir. Take note of the dot after -extdir. It is not a typo; it tells the adt packager to look for the extension in the current directory. For building an Android application, use the 'apk' target instead and omit the -provisioning-profile switch. 10. Send a Test Notification With Urban Airship Once you've built your app and successfully installed it on your phone, it's easy to send a test Push Notification with Urban Airship: 1. Log in to your account on http://www.urbanairship.com and select your new app. 2. Choose 'Push' from the left-hand menu.
3. Select 'Device Tokens'. You should see a token on the list for your own phone. Copy the token to the clipboard. 4. Choose 'Test Push Notifications' and the ios Tab. For Device Token, paste the Device token you just copied. For Alert, enter the text of your message. If you want the alert box window to have a title, add an atitle property to the JSON Payload. See the screenshot above for an example. 5. That's it! The notification should trigger on your device. To send a notification to multiple devices, use the Send Broadcast option instead. 11. Troubleshooting Common Problems Problem: itunes Will Not Install my App. Solution: Make sure you are using the.mobileprovision file you created in Section 1. Carefully reread the 'Update Your Application Descriptor' instructions and make sure you've updated the descriptor with the correct values and IDs.
Problem: Notifications don't appear on phone. Solution: Listen for the PNAEvent.TOKEN_REGISTERED and PNAEvent.TOKEN_REGISTRATION_FAILED to be sure you're tokens are reigstering. Solution: Make sure you have not disabled Push Notifications on the phone. Solution: Make sure you pressed 'Allow' when the app asked if you want to accept push notifications. If you did not press Allow, you need to uninstall the app and wait 24 hours before trying again. Uninstalling the app, setting the clock forward a couple days, and restarting the phone may also help.