Flex with Packager for iPhone Tips
NOTE: Currently Flex SDK even Flex Hero SDK is not optimized for use with Packager for iPhone. This post is meant as an FYI if you are really are trying to use Flex with PFI. Support for iOS and Flex is coming
I will assume you are using the latest Packager for iPhone (PFI) from the labs.adobe.com. Once you have downloaded the bits and are using the
pfi command on the command line with your compiled Flex apps you might come across a few issues.
Exception in thread “main” java.lang.Error: Unable to find named traits: mx.collections.errors::ItemPendingError
This is caused when trying to package a debug SWF, which is by default in Flash Builder in the bin-debug. What you want to do is use Flash Builder to export a release build or in the command line mxmlc arguments make sure debug=false is set.
App compiles to ipa but only shows a white background.
This typically is an issue with the fact that they application is trying to load RSL’s which happens in the Flex’s preloader cycle. Thus the app hangs on an error and no preloader is displayed and you get a app with a white background. You will need to merge the framework code into your SWF. Again if you are using Flash Builder go into Properties -> Flex Build Path -> Library Path tab and make sure the merge type on the framework swc’s is set to Merge into code.
The other time this might come up is when you are using a debug version of the SWF in the PFI package step. The app will die somewhere in the preloader and again not get to the application. If you want to play around and see where its dying in the preloader you can use a customer preloader much the
com.renaun.preloader.TimedPreloader I used in here.