MikeH
MikeH

Reputation: 103

Air to IPad Release Build failing on asset loads

Having some issues getting a release build of an Air IOS Ipad app running (starling based).

I am doing a release build, and saving the ipa file on my drive. I double click the ipa to get it into iTunes, and from there I do an app install onto the iPad.

Once on the ipad, the app fails to load any external files. I put up a preloader, and attempt to load assets via Loadermax, however, it seems to fail.

Here is the code section that the app fails on: (NOTE: this all works in debug mode, both in Air simulator, and debug mode on device via usb)

import com.greensock.events.LoaderEvent;
import com.greensock.loading.ImageLoader;
import flash.filesystem.File;
 ...
 ...
var _imageLoader:ImageLoader;
 ...
 ...
private function loadAssets():void{
  var _appFile:File = File.applicationDirectory;
  _appFile = _appFile.resolvePath("assets/statics/blueImage.png");
  _imageLoader = new ImageLoader(_appFile.nativePath, {onComplete:onImageLoaded, onFail:onImageLoadFail});
}
private function onImageLoaded(e:LoaderEvent):void{
  traceOut("OH MY GOD BATMAN, IT WORKED!!!");   // traceOut is a helper method that prints to a textfield on the display
}
private function onImageLoadFail(e:LoaderEvent):void{
  traceOut("back to the Bat Cave...");
}
...
...

In debug mode, the above code shows:

OH MY GOD BATMAN, IT WORKED!!!

In release build:

back to the Bat Cave...

Anyone know where I am going off the rails? I am not using any ANE's or such.
Based in SDK: "http://ns.adobe.com/air/application/14.0"

Upvotes: 2

Views: 313

Answers (2)

MikeH
MikeH

Reputation: 103

Firstly, Thank you to to the individuals who assisted in getting to the root of this problem and solving, especially BotMaster.

The issue really has to do with Flashbuilder, and a bug that is associated with it's Build Release wizard.

After reading this: https://forums.adobe.com/message/5750011

What I did was:

  1. click the "Export Release Build" button in Flashbuilder,
  2. IMPORTANT: check the box for "Keep bin-release-temp folder"
  3. Click Next
  4. Click Cancel
  5. Via Windows Explorer, navigated to the bin-debug folder, and copied the "assets" and "configuration" folders to the "bin-debug-temp" folder that was generated by flash-builder
  6. I return to Flash builder, and Click on "Export Release Build" button again.
  7. Check the box for "Keep bin-release-temp folder"
  8. Click Next
  9. Check the boxes beside "assets" and "configuration", Click Finish.

the newly generated ipa file had the folders I required.

Once again, thanks to those who contributed to resolve this bug.

Upvotes: 1

BotMaster
BotMaster

Reputation: 2223

PCs are not case sensitive but Ios is. While in simulator or debug mode a file name "myFile" would work even if it's really "myfile" (note the cap difference) on release mode it will fail.

If that doesn't work then try using the url property of File instead of nativePath. Also you can easily check is the file exist prior to loading it:

if(_appFile.exist)

Also when depending on custom frameworks you force yourself on depending on their shortcomings. Use a classic Loader instance to repeat the same operation and see if that one succeed. You'll be surprise the number of times a custom framework can fail on simple operations simply because the way it's setup internally.

Upvotes: 1

Related Questions