Problems when bundling for iOS with a framework

I am integrating the Mixpanel framework for iOS and Defold has problems with some of it’s files.

  • Image files somehow have invalid header (getting I/O error), but open fine in editors.
  • Some files have “~” character in it’s name, but Defold says it’s an illegal character (it’s not).

PNGs are inside the framework.
https://github.com/mixpanel/mixpanel-iphone/releases/download/v3.5.0/Mixpanel.framework.zip

We added restriction for ~as a extra safety measure to not be able to include things from the home folder. And, tbh, I’ve never seen that character used in filenames. Why they couldn’t just use - is beyond me.

We can probably change that at some point.
Workaround is ofc to rename the files for now.

But renaming will probably break the extension? Won’t find it’s storyboard.

Ah, ofc. Then I don’t know of any workaround right now.

What about failing to build due to PNG files?
I think the builder shouldn’t even care about PNG files inside frameworks.

We just add the frameworks to the command line.
What is the error you’re getting?
And why is there a png inside it?

I am getting

/mixpanel/lib/ios/Mixpanel.framework/MPArrowLeft@2x.png
	I/O error reading PNG header!

when trying to build with this framework. I had to resave each PNG file for Defold to stop complaining, they open in editors just fine. It’s not the first time I stumble across such problem.
Some frameworks include UI elements, hence storyboards and images.

It seems like bob doesn’t like the png files. I get:

javax.imageio.IIOException: I/O error reading PNG header!
	at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readHeader(PNGImageReader.java:315)
	at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readMetadata(PNGImageReader.java:698)
	at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readImage(PNGImageReader.java:1395)
	at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.read(PNGImageReader.java:1810)
	at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1468)
	at java.desktop/javax.imageio.ImageIO.read(ImageIO.java:1363)
	at com.dynamo.bob.pipeline.TextureGenerator.generate(TextureGenerator.java:317)
	at com.dynamo.bob.pipeline.TextureBuilder.build(TextureBuilder.java:49)
	at com.dynamo.bob.Project.runTasks(Project.java:1010)
	at com.dynamo.bob.Project.doBuild(Project.java:811)
	at com.dynamo.bob.Project.build(Project.java:438)
	at com.dynamo.bob.Bob.main(Bob.java:558)
Caused by: javax.imageio.IIOException: Bad length for IHDR chunk!
	at java.desktop/com.sun.imageio.plugins.png.PNGImageReader.readHeader(PNGImageReader.java:247)

If I resave the image within the .framework bob no longer complains about the images but instead we stop at the ~ character in the filenames. We’ll change this on the build server to only prevent it if the path starts with a tilde character.

1 Like