Game of Life HaXe & NME on iOS

For the last few days I have been playing around with trying to get the game of life sample from my previous post working on the iPhone using haXe with NME.

In theory NME should do all the heavy lifting for you so that it should be as simple as running:

</p>
<pre>haxelib run nme build nmebuild.nmml ios</pre>
<p>

Unfortunately however when I ran this I was getting rather cryptic errors:

</p>
<pre>Called from ? line 1
Called from InstallTool.hx line 384
Called from a C function
Called from InstallTool.hx line 70
Called from a C function
Called from installers/InstallerBase.hx line 61
Called from installers/InstallerBase.hx line 668
Called from installers/InstallerBase.hx line 762
Called from haxe/xml/Fast.hx line 59
Uncaught exception - icon is missing attribute name</pre>
<p>

I had read from the NME documentation page that this may have been fixed in the more reccent versions of NME. So I downloaded the beta version (you could checkout from SVN too if you wish) and told haxelib that im going to be working with a development version of NME with the following command:

</p>
<pre>haxelib dev nme /Users/mikec/Documents/NME_3.1_Beta</pre>
<p>

Now when I try to build for ios I get success!

From there is a simple matter of opening the generated xcode project, connecting my iphone and hitting run:

I really like how easy the workflow is compared to the Adobe Air packaging system. Generating the xcode project makes things so much faster.

If I can get my hands on an Android phone next I think im going to have to have a go at getting this sample working on there too!

9 Responses to Game of Life HaXe & NME on iOS
  1. Joshua Granick Reply

    If you would like to build and run your project using a single command, you can use:

    haxelib run nme test nmebuild.nmml flash
    haxelib run nme test nmebuild.nmml ios -simulator
    :)

    • Anonymous Reply

      Aye :) Really handy commands those. Is there any reason why you couldnt use “haxelib run nme test nmebuild.nmml ios” which would then cause xcode to fireup and launch to the iphone?

      • Joshua Granick Reply

        Going to a device requires provisioning and certificates, unlike the simulator. Most people I ask say that going straight to the device from the command-line cannot be done, but I’m sure it can. If anyone has tips (or wants to hack the install tool code) to support a device install and run, I’d love to hear it :)

        • Anonymous Reply

          Well the question is, do you go to the device via xcode or via some manual mechanism that xcode must use behind the scenes. Is it possible to execute functionality in xcdode externally? “xcode MyApplication.xcodeproj -launch iPhone” ?

          I would offer my assistance with this however I have very little xcode or osx experience :(

  2. Stefan Richter Reply

    Have not used nme myself before – do you end up with an .ipa file that you want to sync to the device via iTunes? If yes then that step should be automatable (if that’s a word :-) via osascript

    Something like
    osascript -e ‘tell application “iTunes” to update “myappname”‘

    Not sure if that helps but there you go :-/

  3. Stefan Richter Reply

    Ok, reading more closely to the comments I think you may not be able to add to iTunes and run on device unless you do compile with a provisioning cert in some way. Maybe the simulator is the way to go until you are ready for (manual) on device deployment/testing.

    • Anonymous Reply

      It creates an xcode project which it then compiles and runs on the device. It seems like you could script it indeed

Leave a Reply

Your email address will not be published. Please enter your name, email and a comment.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>