Now that AIR for iOS is back in business, I thought I’d post a quick refresher on how to get the Packager for iPhone working. I tested it yesterday with all kinds of combinations of AIR and iOS versions which have come out since we stopped working on PFI, and everything still works perfectly. It only took me about fifteen minutes to get my environment set up again, and to get iReverse compiled and running on my iPhone 3Gs. (Yes, it might finally be time to upgrade to the iPhone 4.)
If you’re ready to get started developing for iOS devices again, here’s everything you need to know:
1. Download the Packager for iPhone Project
The Packager for iPhone (PFI) project is still available on Adobe Labs, and it still works great. The first step is download and unpack it.
2. Download the Latest AIR SDK
If you’re reading this post, you probably already have the AIR SDK on your development machine, but just in case you don’t, you will need to download the latest AIR SDK (2.0.2) and unpack it.
3. Compile Your Application Into a SWF
Even though the last version of PFI was 2.0.1, and the latest version of the AIR SDK is 2.0.2, they are compatible. Compile your AIR application into a SWF using your favorite method (Flash Professional, Flash Builder, command line tools, etc.). Although it’s not the easiest approach, I use the amxmlc command which is the Flex compiler for AIR applications. The command I run looks something like this (you will obviously need to adapt it to your environment):
/Your/Path/to/FlashBuilder/sdks/4.1.0/bin/amxmlc -sp /Path/to/Your/Project/src -el /Your/Path/to/FlashBuilder/frameworks/libs/air/airglobal.swc -o YourApplication.swf /Path/to/YourApplication.as
4. Use PFI to Build an IPA File
All you need to do now is compile your SWF into an IPA file for your iOS device. Again, you will have to adapt the following command to your specific configuration, but I use something similar to this:
pfi -package -target ipa-app-store -provisioning-profile /Path/to/Your/Provisioning/Profile -storetype pkcs12 -keystore /Path/to/Your/Certificate.p12 -storepass your_password YourApplication.ipa /Path/to/YourApplication-app.xml -C /Path/to/Your/SWF/and/Assets/Directory YourApplication.swf Default.png Icon_57.png
5. Install the Application on Your Device
To install the application on your iPhone, iPod touch, or iPad, simply drag the IPA file into iTunes and sync it with your device. You should see your application icon appear on your device’s home screen.
Epilogue
I recognize that this workflow is far from ideal, especially for developers who use Flash Builder. Keep in mind that what you’re seeing here represents a very low-level usage of the SDKs, and not what we were ultimately planning on releasing. However, we stopped working on PFI before our tools and frameworks could catch up and make the process much simpler.
Moving forward, that won’t be the case. Now that we are once again committed to the iOS platform, we will work on tools and frameworks to make developing iOS applications much easier. I’m currently using early versions of these projects for Android development, and they are extremely easy to use and help to create a very efficient developer workflow. Unfortunately, we’re not going to have these tools and frameworks in place for iOS development overnight, but we will have them, and we will provide developers the easiest, fastest, and most efficient path to writing multi-screen, cross-device applications.

From cocoa I need to have distribution or developer certificates to deploy to iPad/iPhone. How does that work with PFI?
Or use the Flash CS5?
PFI, Air for Android and “hero”. Is there a plan to make the next Flash Builder the place where building apps for the web, desktop and mobile takes place?
The packager works great! here a capture of an AIR based app working like an iPad app – http://dl.dropbox.com/u/314340/shakpesHD.mov (this app is part of this personal project http://www.101.es/shakpes (a multi-screen game project) Thanks Christian for your awsome post!
Thanks a lot Christian for heads up.
Since I don’t use FB and I’m a 100% CLI guy I welcome your examples.
Any chance PFI could be ported to Linux? It’s a shame to see how many tools are based on open source stuff and eventually end up on closed source OSes.
I do use Adobe Air tool chain on Linux every day for product.
-Olivier
I used flash cs5 to build the ipa file as I used to, but when I use the application loader I get the error “Unable to unzip application”. Your help on this would be very much appreciated.
@Alexandros, I had the same issue today (among other issues). Here’s a detailed post on the Packager forums where I explain how I got mine to work:
http://forums.adobe.com/message/3152767#3152767
How can i create an *.ipa file for testing on my device ? i’ve tried with -target ipa-test and -target ipa-app-store but when i try to upload my app on the iPad, iTunes throws an error sayng that i’m not allowed. I’ve done a simple test using the Packager bundled width CS5 (with the same certificates) and everything gone right.
Is is possible to use CS5 Packager for Flex project ? (i know that flex isn’t optimized for mobile)
Thanks
Thanks for the useful post!
@Olivier: I guess on Linux you can simply use the .jar version of the PFI. I’m on Mac and it works correctly
@Christian: I have some problems with icons though… seems like the 29px and 512px icons are not displayed correctly even if embedded in the package and app descriptor. Only the 57px is working as expected :S
Someone experiencing the same issue?
Thanks,
Leo
Pingback: Flash For Iphone ง่ายๆ 5 ขั้นตอน | HowDoFlash
Keep in mind that your Mac and your iOS device still have to be set up for development which means configuring the correct certificates, provisioning profiles, etc. I should probably write a how-to on that, as well.
@Leo: Are the 29px and 512px icons for devices with retina displays? That I haven’t tested yet. I’ll try to get one soon and see how things work.
@Christian: no, those images are supposed to be for list and store icon (for example: I see the 57px correctly on the phone menu but in iTunes, which should use the 512px version I see the apple placeholder icon instead of the provided image)… weird
Pingback: Swf.hu 2.0 – flash és webfejlesztés » Heti link gyűjtemény
I haven’t tried this with Flash yet, but compiling using pfi gave me the error “Compilation failed…”. I’d love to know why. The error doesn’t really tell me a lot. Don’t suppose anyone could shed some light on this?
Hi Christian, I have a fb project built with Flex4.1 sdk.
I followed your refresher to build my application for iPhone. SWF compile nicely, but when pfi is trying to build the ipa, I get this error wich seems to be relative to a Flex3 missing lib
Exception in thread “main” java.lang.Error: Unable to find named traits: mx.core::IPropertyChangeNotifier
at adobe.abc.Domain.resolveTypeName(Domain.java:195)
at adobe.abc.Domain.resolveTypeName(Domain.java:112)
at adobe.abc.GlobalOptimizer$InputAbc.resolveTypeName(GlobalOptimizer.java:274)
at adobe.abc.GlobalOptimizer$InputAbc.readInstance(GlobalOptimizer.java:848)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:388)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:280)
at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:160)
at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcode(AOTCompiler.java:329)
at com.adobe.air.ipa.AOTCompiler.GenerateMacBinary(AOTCompiler.java:600)
at com.adobe.air.ipa.IPAOutputStream.compileRootSwf(IPAOutputStream.java:196)
at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java:355)
at com.adobe.air.ADTPackager.createPackage(ADTPackager.java:65)
at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:165)
at com.adobe.air.ADTEntrypoint.parseArgsAndGo(ADTEntrypoint.java:132)
at com.adobe.air.ipa.PFI.parseArgsAndGo(PFI.java:152)
at com.adobe.air.ADTEntrypoint.run(ADTEntrypoint.java:68)
at com.adobe.air.ipa.PFI.main(PFI.java:112)
Is pfi working with Flex4.1 or just with Flex3 (projects in Flex3 are ok with pfi) ?
Thx in advance.
Chubby75
Ok, found where the glitch was.
Remember to include external libs to the codebase (no RSL or you’ll get my error).
Use in the compiler option “-compiler.include-libraries”.
Cheers.
How would I build an iPhone app (using Adobe’s tools) without using Flash? I see no mention of using HTML/CSS/JS along with AIR and PFI to build iOS apps. Why is Adobe treating AJAX developers like second class citizens?
Hey Christian,
Excellent writeup, it’s interesting to know that we can use the CLI to package iPhone apps from projects built with Flash Builder.
Is there a method to compiling/packaging apps that use Flex Components?
I’m able to get through the whole process described here, but the app only shows as a blank white screen on the actual iPhone. I made a simple test Flex app that uses an MXML layout with a single label with the word ‘test’ in it, so it’s about as dead simple as one can get, but alas, no joy…and I’m a bit lost as to how to troubleshoot this.
Hello,
according to Adobe’s Packager for iPhone:Developer FAQ there are restrictions on Microphone Access.
This restriction is still present?
Thanks in advance
michelangelo
Any idea what this means? Exception in thread “main” java.lang.Error: Unable to find named traits: mx.collections.errors::ItemPendingError
at adobe.abc.Domain.resolveTypeName(Domain.java:195)
at adobe.abc.Domain.resolveTypeName(Domain.java:112)
at adobe.abc.GlobalOptimizer$InputAbc.resolveTypeName(GlobalOptimizer.java:274)
at adobe.abc.GlobalOptimizer$InputAbc.readCode(GlobalOptimizer.java:983)
at adobe.abc.GlobalOptimizer$InputAbc.readBody(GlobalOptimizer.java:531)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:404)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:280)
at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:160)
at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcode(AOTCompiler.java:329)
at com.adobe.air.ipa.AOTCompiler.GenerateMacBinary(AOTCompiler.java:600)
at com.adobe.air.ipa.IPAOutputStream.compileRootSwf(IPAOutputStream.java:196)
at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java:355)
at com.adobe.air.ADTPackager.createPackage(ADTPackager.java:65)
at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:165)
at com.adobe.air.ADTEntrypoint.parseArgsAndGo(ADTEntrypoint.java:132)
at com.adobe.air.ipa.PFI.parseArgsAndGo(PFI.java:152)
at com.adobe.air.ADTEntrypoint.run(ADTEntrypoint.java:68)
at com.adobe.air.ipa.PFI.main(PFI.java:112)
managed it to go through the whole process either, but only get a white screen in the end as well….
I’m having the same problem as Joe, seeing only a blank screen (the background color of the application)
@michelangelo
Yes, the microphone APIs don’t work in PFI. They do work in Android, and we will enable them eventually on iOS as well, but currently, they are not enabled.
@wolfgang and @gordon
How are you drawing your applications? Are they AS based? Flex? Authored with Flash Pro?
It sounds to me like the initial event that initiates the drawing of you applications isn’t being thrown for some reason.
It’s a flex mxml application. I got it working fine now on the iphone by changing the WindowedApplication tag to Application.
Gordon,
can you provide me with the exact steps to be able to package a flex application for the iphone?
I’m also able to get through the whole process but I only see a blank screen on the phone.
Pingback: Update on Flash and iPhone development (Adobe Flash Platform Blog)
pfi -package -target ipa-app-store -provisioning-profile /Path/to/Your/Provisioning/Profile -storetype pkcs12 -keystore /Path/to/Your/Certificate.p12 -storepass your_password YourApplication.ipa /Path/to/YourApplication-app.xml -C /Path/to/Your/SWF/and/Assets/Directory YourApplication.swf Default.png Icon_57.png
I assume to run this in terminal on mac…
what is the provisioning file and what is the certificate here? I have a pfx certificate not a p12 certificate….
Is there a way to do this without a provisioning profile? For example, if I just wanted to try it out on the simulator.
i solved it by not using mxml at all
just pure as3
i’m having problems with the packager.
firstly, i’m trying to use the robotlegs framework, but cannot get it to work on the device, i just get a blank screen.
secondly, i cannot get a simple enter frame event to work where i move a movieclip to the mouse x+y (i’m assuming that mouseX and mouseY means fingerX and fingerY?)
i have managed to get simple thing to work, such as drawing shapes and tweening them using tweenlite.
i guess this whole process would be a lot easier if i could debug on the device properly. i have set up remote debugging over wifi and it works fine when the app actually works, but when i get the blank screen and the app doesn’t work, i get no error output or traces at all, meaning it is impossible to find out where i am going wrong…
can anyone suggest a way of troubleshooting so i can get this up and running, or point out where i am going wrong?
thanks
i might add that i am doing all of these tests independently.
I continue to get the ItemPendingError. I have checked and i’m not using any RSL’s it’s set to merge into code. I have tried flex 4.0 and 4.1 both with air 2.0.2. I’m not using spark and I changed from WindowedApplication to just “Application”. Anyone have any idea’s?
@Christian I finally got your example to work. My main issue was differences in the app descriptor xml between the one that comes with the sdk and the one that Flash CS5 makes for you (which is much more pared down). I ended up using the xml file that Flash CS5 made for me to then use the command line to create the .ipa. Do you know of a document that details the app descriptor schema, its allowed values and which nodes can or should be omitted depending on the device target? That would be so helpful.
I’m having the same problem running PFI.BAT I get the ‘Compilation Failed…’ message and no other clues at all. I assume I have done something wrong somewhere. I tried this with Flash CS5.. created the ‘Hello World’ app – it worked fine. I am trying it with Flex Builder 4 now the Flex ‘Hello World’ app does not work. The message is cryptic, a dead end.
So I am getting the item reference error, and I am not set to RSL, my project properties are set to merged into code. I do not have a debug perspective open – flash perspective only. I also added to project properties – flex compiler: -compiler.include-libraries
How do I get rid of this error?
Exception in thread “main” java.lang.Error: Unable to find named traits: mx.collections.errors::ItemPendingError
at adobe.abc.Domain.resolveTypeName(Domain.java:195)
at adobe.abc.Domain.resolveTypeName(Domain.java:112)
at adobe.abc.GlobalOptimizer$InputAbc.resolveTypeName(GlobalOptimizer.java:274)
at adobe.abc.GlobalOptimizer$InputAbc.readCode(GlobalOptimizer.java:983)
at adobe.abc.GlobalOptimizer$InputAbc.readBody(GlobalOptimizer.java:531)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:404)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:280)
at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:160)
at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcode(AOTCompiler.java:329)
at com.adobe.air.ipa.AOTCompiler.GenerateMacBinary(AOTCompiler.java:600)
at com.adobe.air.ipa.IPAOutputStream.compileRootSwf(IPAOutputStream.java:196)
at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java:355)
at com.adobe.air.ADTPackager.createPackage(ADTPackager.java:65)
at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:165)
at com.adobe.air.ADTEntrypoint.parseArgsAndGo(ADTEntrypoint.java:132)
at com.adobe.air.ipa.PFI.parseArgsAndGo(PFI.java:152)
at com.adobe.air.ADTEntrypoint.run(ADTEntrypoint.java:68)
at com.adobe.air.ipa.PFI.main(PFI.java:112)
Pingback: How to Use Packager for iPhone to Build iPad Applications « Christian Cantrell
Hi Christiana,
I was having 3 iphone apps which is in .swf format and i tried to convert them into .ipa, in order to deploy on iPad. and I used Adobe iPhone packager and issued the command which you mentioned above.
How ever I was successfully converted one app and deployed on iPad and it is working fine. But for second app I am getting the fallowing error.
Exception in thread “main” java.lang.OutOfMemoryError: Java heap space
at adobe.abc.GlobalOptimizer$FrameState.(GlobalOptimizer.java:9154)
at adobe.abc.GlobalOptimizer.createBlock(GlobalOptimizer.java:9170)
at adobe.abc.GlobalOptimizer.merge(GlobalOptimizer.java:9217)
at adobe.abc.GlobalOptimizer$InputAbc.readCode(GlobalOptimizer.java:1051)
at adobe.abc.GlobalOptimizer$InputAbc.readBody(GlobalOptimizer.java:531)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:404)
at adobe.abc.GlobalOptimizer$InputAbc.readAbc(GlobalOptimizer.java:280)
at adobe.abc.LLVMEmitter.generateBitcode(LLVMEmitter.java:160)
at com.adobe.air.ipa.AOTCompiler.convertAbcToLlvmBitcode(AOTCompiler.java:329)
at com.adobe.air.ipa.AOTCompiler.GenerateMacBinary(AOTCompiler.java:600)
at com.adobe.air.ipa.IPAOutputStream.compileRootSwf(IPAOutputStream.java:196)
at com.adobe.air.ipa.IPAOutputStream.finalizeSig(IPAOutputStream.java:355)
at com.adobe.air.ADTPackager.createPackage(ADTPackager.java:65)
at com.adobe.air.ipa.IPAPackager.createPackage(IPAPackager.java:165)
at com.adobe.air.ADTEntrypoint.parseArgsAndGo(ADTEntrypoint.java:132)
at com.adobe.air.ipa.PFI.parseArgsAndGo(PFI.java:152)
at com.adobe.air.ADTEntrypoint.run(ADTEntrypoint.java:68)
at com.adobe.air.ipa.PFI.main(PFI.java:112)
And 3rd app is converted into .ipa file but when i deployed on ipad and tried to run it is crashing.
Can you please let me know the reason for the last two scenarios .
Thanks & Regards,
Ravi Bukka
b_ravi_b@hotmail.com
Hello Christian, and everyone
i’m also getting a blank screen after i deploy to the iphone using flashbuilder for creating the as3 code and embeding assets using a swc any ideas why my swc doesn’t seem to be getting merged into the code ?
There is lack of good examples on adobe AIR for iphone development.
Any help on sharing the code would be highly appreciated
So I’m wondering if anybody successfully tracked down the issue with blank white screens? I’m following the tutorial example from the getting started .pdf, and while I can build in Flash successfully, using Flash Builder and then the console tools leave me with an app that is a simple white screen.
I would guess that the main ‘application.swf’ that contains a constructor with all of my drawing parameters (to fill the screen with a green square) is not being successfully run.
Where if I put that same logic into the timeline on the example built in Flash, it works fine.
Any thoughts on why our code in our main application.swf is not being run when the iOS app initializes?
food for thought but on the iphone it responds to mousevent click instead of touch event tap
Hello
for anyone with the ” Exception in thread “main” java.lang.Error: Unable to find named traits: ” pfi error, try to add in the flex compiler: -compiler.include-libraries as mentions and try Project->export release build.
pfi works fine with that but i get the white screen pb when installing the app.
Hope it helps
Ravi: If the iPhone Packager is running out of heap space you can re-run pfi with java -Xmx2048m -jar lib/pfi.jar
Pingback: Flex 4 in IOS 3 | RIA and Mobile Developer
Hi Alex,
You mean to say first I have to run the command “java -Xmx2048m -jar lib/pfi.jar” on terminal in my Mac book pro in order to increase the heap size of the app, and later I have to run the complete pfi command (which include path to my provisioning profile and certificate as parameters).
Regards,
Ravi Bukka
For those getting blank screens make sure your ‘YourApplication-app.xml’ is as below:
com.example.HelloWorld
MobileDesigner
Hello World
v1
gpu
HelloWorld.swf
true
portrait
true
true
mobileDevice
<!– icons/icon29.png –>
Icon_57.png
<!– icons/icon512.png –>
<![CDATA[
UIStatusBarStyle
UIStatusBarStyleBlackOpaque
UIRequiresPersistentWiFi
NO
]]>
Another tip is don’t draw anything in the main Sprite’s constructor, create an init() method and call that from the constructor.
Hope that helps,
Alastair
Woops tags got stripped out. See here for the fix
http://blog.alastairdawson.com/2010/10/27/getting-a-blank-screen-when-using-adobes-flash-packager-for-iphone/
Pingback: Getting a blank screen when using Adobe’s Flash Packager for iPhone? – Alastair's Axioms
I’m trying to compile an Air app with pfi and I’m also getting the error “Compilation failed…”. Is there a log or any chance to get more info than that?
Hey everyone… I am also getting the white screen issue when deployed to my iPhone… I am using FlashBuilder 4 with no MXML at all…
Only thing in the main class is this that is in the constructor
import flash.display.Sprite;
import flash.display.StageAlign;
import flash.display.StageScaleMode;
public class ReversiIphone extends Sprite {
private var reversi:Reversi;
public function ReversiIphone(){
super();
this.stage.scaleMode = StageScaleMode.NO_SCALE;
this.stage.align = StageAlign.TOP_LEFT;
reversi = new Reversi( 163 );
addChild( reversi );
}
}
Anyone else have this issue?
Any help would be greatly appreciated!
Derek
Sorry that is not just the constructor… that is the main class itself… And I forgot that it is within the
package {
}
Thanks
Where am I supposed to enter the code from step 4. Where is the command line? what is the amxmlc command? Why am I the only one who doesnt get it?
I have an app already on the app store that I made with flash cs5. After long painstaking hours of research I was finally able to get it to submit. Now, I’ve finished my update for that app, and just can’t get it to submit. The errors I keep getting are:
* Application failed codesign verification. The signature was invalid, or it was not signed with an Apple submission certificate.
* Unable to extract codesigning entitlements from your application. Please make sure Application.app is a valid Mach executable that’s properly codesigned.
My .p12 and mobileprovision both came out of my distribution profile. I’m so frustrated right now. I feel like I’ve tried everything. Do you have any advice for me?
Thanks in advance,
Michael
Hi guys,
I have most of my game working on iPhone, however…
When I attempt to use the Box2D 2.1a source in my app it only shows a White screen, do you know of any incompatible syntax that could cause this? (I am using the Libs for Flash 9 that don’t use the Vector class!). I read somewhere that switch statements can cause this but would like clarification, thanks in advance!
P.S. If I can get this going I’ll have a game in the app store soon written in Flash that will also work on Android and as a web app, Adobe Rock!!!
Pingback: Architect, Engineer, Tech Enthusiast – Hasan Otuome – Using ANT to Compile a Flex Mobile Project for iOS
Hi!
I am having a hardtime trying to set up 2 joysticks with in a game made with flash for iPad. It sure can detect multiple touch, but I still can figure out how to detetc the touch movemente while draggin multiple fingers on the screen. I ve seen some games examples and it seems possible but still cant figure out how to do it.
Hope you could help. Thanks!
Pingback: Using ANT to Compile a Flex Mobile Project for iOS - Almer/Blank Labs
Is there any way extend or bridge a flash project with an objective-c project? For instance using GameKit to allow multi-user games over Bluetooth for a flash game that has been compiled to native iOS code with PFI.
Hello,
where can I download the Packager for iPhone?
I can’t found it in labs!
PFI doesn’t seem to be available anymore – the Labs page was taken down and the archived version of AIR 2.0.2 doesn’t include it. This is probably because the adt tool in AIR 2.6 supports ipa targets (ipa, ipa-test, etc.), but I can’t get it to build an ipa that works on older hardware.
I’ve tried compiling the SWF with Flex 4.1.0 (linked to AIR 2.0) and specifying the 2.0 namespace in the app descriptor. I get an ipa and the tool doesn’t throw any errors, but my second-gen iPod rejects it with the same message I get if I just use AIR 2.6 all the way through (“not compatible with this iPod”). I don’t know what else to try. Am I just out of luck?
I can’t find the PFI either. Is there some workaround available?