Tuesday, September 21, 2010

Deploy to iPhone with Flex Builder: even better

I promise this is the last post about this boring topic.
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. If not, you can download it from here.

Ok, this is an even easier way to deploy to iPhone from Flex Builder 3 or Flash Builder 4. Just follow this steps and you will be ready to go in 2 minutes:
  1. Download these batch files and put them wherever you want. In these files you need to configure the variables PFI, PROV_PROFILE_PATH, CERTIFICATE_PATH and PASSWORD. In the debug batch files, you also need to change the ip address next to the -connect option by the ip of the machine running the debugger.
  2. Download the launch configurations from here. Inside the zip you will find 4 .launch files. Put them in <Flex Builder Workspace Path>\.metadata\.plugins\org.eclipse.debug.core\.launches and restart Flex Builder.
  3. Now, go to Run->External Tools->Open External Tools Dialog... . In the four launch configurations you need to adjust the Location field to point to the correct batch file downloaded in the step 1. You should see something like this:



  4. That's it. Now you can build for iphone in debug or test mode, and with rendering diagnostics enabled or not.

11 comments:

  1. This is Great! Thanks. I keep running into this error and can't find any way around it. I've searched and other people are having the same issues but are fixing it via not linking to RSLs. I don't think I am. Do you have any thoughts?

    C:\inetpub\wwwroot\debugarea\exp1-debug>call "C:\Program Files (x86)\Adobe\Adobe Flash CS5\PFI\bin\pfi.bat" -package -target ipa-test -provisioning-profile "C:\inetpub\ipodconfig\testcase.mobileprovision" -storetype pkcs12 -keystore "C:\inetpub\ipodconfig\iphone_dev.p12" -storepass "Howdy" "C:\inetpub\ipaexport\exp1.ipa" "C:\inetpub\wwwroot\debugarea\exp1-debug\exp1-app.xml" "C:\inetpub\wwwroot\debugarea\exp1-debug\exp1.swf" "Default.png" "icons\icon57.png"
    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)

    ReplyDelete
  2. "boring topic"??
    You must be kidding! This is an amazing tutorial!!

    THANKS!!!

    ReplyDelete
  3. Hi Jaime,

    I guess it's possible to make it work in mac, but you have to replace the batch files(windows only) by shell scripts that do the same thing. Sorry not be able to help you more, I have almost no experience in mac environments.
    I've been a bit disconnected from all this thing of building flash applications for iphone, but I hope Adobe include some way of deploy to iphone in future versions of Flash Builder.

    ReplyDelete
  4. Any idea why I'd get this error?

    Exception in thread "main" java.lang.Error: Unable to find named traits: mx.collections.errors::SortError
    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:366)
    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)

    ReplyDelete
  5. I can't test it myself because I don't have a valid provisioning right now, but according to what some people say, it could be a problem with the way external libs are being linked in your project. Make sure they are linked as "Merged into code" instead of "Runtime shared library(RSL)". In Flex/Flash Builder you can find this option in Project Properties -> ActionScript Build Path -> "Library path" tab.
    Hope it helps.

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. To Dan Card:
    Sorry I didn't see your comment before, blogger marked it as spam for some reason.
    I guess you already solved the problem, but to answer your question: I have no idea what the problem could be if isn't a library linking issue. I'm sorry I cannot be more helpful.

    ReplyDelete
  8. Not having a UI for PFI on the Mac sucks, Sooooooo......

    I made one: http://nanurl.com/mmgzk

    Happy Packing! :D

    ReplyDelete
  9. Hello!

    I'm trying to compile my first flash iphone game, but I have an error.

    absolute path: C:\develop\workspace\03_Four_in_a_row\bin-release\game.swf

    Why I get this error? There is something wrong with this path?

    Thanks in advance.

    ReplyDelete
  10. Hello!

    I'm trying to compile my first flash iphone game, but I have an error.
    For remove this error put the relative path.

    I do the same error and clear the error with this


    absolute path: C:\develop\workspace\03_Four_in_a_row\bin-release\game.swf

    Why I get this error? There is something wrong with this path?

    Thanks in advance.

    ReplyDelete