Update on Xamarin Studio & libgdx on iOS

Small update on the libgdx on iOS issues we talked about yesterday. First of all, i rebuild our IKVM-monotouch fork with the latest MonoTouch toolchain. The assemblies now reference the new signed MonoTouch assemblies. The updated IKVM build can be found in the nightlies.

If you downloaded the latest version of Xamarin’s iOS line (formerly known as MonoTouch, now known as Xamarin.iOS), your libgdx project will most likely crash. This is due to Xamarin Studio calling pngcrush, a supposed PNG optimizer.

nqffYxf

Libgdx’s image loading library of choice, stb_image seems to have problems decoding these crushed PNGs. You will see the following stack trace:

kbIgfUO

Now, the older MonoTouch version used MonoDevelop. That called a script called iphoneos-optimize. This resulted in the same problem, so we proposed a workaround, boiling down to modifying the script. The script was only called for device builds. In the new Xamarin Studio, pngcrush is called for all types of builds.

I reached out to some nice folks at Xamarin, which told me that a project setting will be available within 1-2 weeks that will allow us to turn of pngcrush easily.

If you can not wait, here is a temporary workaround. First locate pngcrush on your Mac. In the terminal:

Create a backup copy of it.

Create a file called pngcrush with the following content

this simply copies the file specified in the 5th parameter to the file specified in the 6th parameter. That’s what Xamarin Studio would pass to pngcrush as we saw above.

Now replace the pngcrush executable in the directory we located previously with the hackish script file. Double check that you made a backup!

Voila, all your iOS builds will start working again.

Again, this is only a temporary hack. Once Xamarin Studio gets updated, we can savely copy back the pngcrush file to its original place, and just flip a switch in the iOS project configuration.

I’ll post an update once the Xamarin studio update is out of the door.

One thought on “Update on Xamarin Studio & libgdx on iOS

Leave a Reply

Your email address will not be published.