Sunday, September 19, 2010

Deploy to iPhone with Flex Builder

Edit: There is an improved version of this here.
Edit 2: There's an even better version here.

Follow these steps:

1. First, you need the Packager for iPhone from Adobe. If you have installed Flash CS5, you can find the packager in %ProgramFiles(x86)%\Adobe\Adobe Flash CS5\PFI or %ProgramFiles%\Adobe\Adobe Flash CS5\PFI.

2. Create a file Pack.bat with this content:

set PFI=C:\Program Files (x86)\Adobe\Adobe Flash CS5\PFI\lib\pfi.jar
set RES_PATH=C:\Users\John\Documents\Flex Builder 3\Test\bin-debug
set PROV_PROFILE_PATH=C:\Users\John\Documents\Flex Builder 3\Test\bin-debug\John.mobileprovision
set CERTIFICATE_PATH=C:\Users\John\Documents\Flex Builder 3\Test\bin-debug\JohnDevCertificate.p12
set PASSWORD=123456
set APP_XML_PATH=C:\Users\John\Documents\Flex Builder 3\Test\bin-debug\Test-app.xml
set IPA_PATH=C:\Users\John\Documents\Flex Builder 3\Test\bin-debug\Test.ipa

cd %RES_PATH%

java -jar "%PFI%" -package -target ipa-test -provisioning-profile "%PROV_PROFILE_PATH%" -storetype pkcs12 -keystore "%CERTIFICATE_PATH%" -storepass %PASSWORD% "%IPA_PATH%" "%APP_XML_PATH%" "%RES_PATH%\Test.swf"

or download it from here.

You need to change the paths to point to where you have each corresponding item in your machine.

3. In Flex Builder, go to Run->External Tools->Open External Tools Dialog... and create a new launch configuration by clicking in the little button with the plus symbol.
In the Location text box, write the path to the Pack.bat file. You can use "Browse Workspace..." if the file is located inside your project directory or "Browse File System..." if not. You should get something like this:


4. Now, after building your project as usual, go to Run->External Tools->Pack


This is valid for Flex Builder 3, but I think it should work with Flash Builder 4 too.

Hope it's useful to someone. Feel free to ask if something isn't clear.

No comments:

Post a Comment