Copy link to clipboard
Copied
Hey Guys,
So I finally got push notifications going on iOS and I'm thrilled. Here's some issues I ran into that will help you folks out with the example code they are giving here: http://blogs.adobe.com/airodynamics/2012/05/29/push-notifications-support-in-ios/
1.) The release notes are not valid.
import flash.notifications;
Should Be:
import flash.notifications.*;
if (RemoteNotifier.supportedNotificationStyles() != NULL) {
Should Be:
if (RemoteNotifier.supportedNotificationStyles != null) {
subscribeOptions.notificationStyle = preferredNotificationStyles;
Should Be:
subscribeOptions.notificationStyles = preferredNotificationStyles;
2.) The three variables needed to subscribe to the APN should be declaried in the class body not scoped function local:
private var _preferredNotificationStyles : Vector.<String>;
private var _remoteNotifier : RemoteNotifier = new RemoteNotifier();
private var _subscribeOptions:RemoteNotifierSubscribeOptions;
3.) When Flash Builder creates the debug version of the app.xml file located in bin-debug/[appname]-app.xml , it changes the application id to end in .debug. So com.examplecompany.exampleapplication.debug This will prevent the APNS from sending the alert right. So you have to edit the app.xml build file, in the bin-debug folder, and change the name back without the .debug. You'll probably get a 'derived' warning which is ok. If you ever do something that updates the app.xml file located in the src folder, I'd recommend deleting the bin-debug folder, run clean, rebuild and then re-edit the app.xml located in the debug folder.
4.) You need an application-identifier key in the entitlements section of the app.xml file. This needs to have the full legal app id which contains the key. see below:
<Entitlements>
<![CDATA[
<key>get-task-allow</key>
<true/>
<key>aps-environment</key>
<string>development</string>
<key>application-identifier</key>
<string>QVRKBH67LJ.com.kiwiworks.cnn</string>
<key>keychain-access-groups</key>
<array>
<string>QVRKBH67LJ.com.kiwiworks.cnn</string>
</array>
]]>
</Entitlements>
5.) Regarding your push service server - I'm not sure if it doesn't work for all of them, but I was unable to send the message request to the push service from my own local computer. It only worked on my remote PHP server. The key was identical.
Error I got locally:
Start Time: 1342873453 | |
Timeout : 300 (sec) | |
Verify return code: 20 (unable to get local issuer certificate) |
What I got when remote:
Start Time: 1342867957 | |
Timeout : 300 (sec) | |
Verify return code: 0 (ok) |
I'll be writing up this entire 2 weeks of work into a blog post soon. Since 3.4 dropped a couple days ago, most of my work is mute, however I did learn a shit ton about extensions, XCode, ObjC and how to do a full compile ant task ( XCode, Extensions, Packaging, Air Building and iOS device loading/unloading of the app). That alone has reduced the process of building with iTunes by like 60-80 seconds per build at worst. So thankful for the new functionality.
Let me know if you have any questions and I'll try to answer them.
Copy link to clipboard
Copied
I'm writting a tutorial now but does anyone want the source code to make an iOS app and a PHP/MySQL web service that will demo the functionality?
Copy link to clipboard
Copied
Hi Pete,
To package your app with a provisioning profile (enabled with Apple Push Notifications Services) you don't have to provide the application identifier and keychain-access-groups in the entitlements .Just the following entitlements will work :
<Entitlements>
<![CDATA[
<key>aps-environment</key>
<string>development</string>
]]>
</Entitlements>
instead you've to provide the app-id in the <id> tag of the app-xml like just another AIR-iOS app(I know that Flash Builder changes the app-id to "app-name.debug" but you can change it while packaging and one strong reason to recommend this way is that for the testing I have uploaded a test app at app-store to validate these entitlements and Apple has approved it.) in following way:
<id>com.kiwiworks.cnn</key> //Remove the Bundle Seed ID from here.
If you've any questions then please feel free to ask.
-Nimisha