Skip to main content
Inspiring
June 13, 2011
Question

AIR for iOS app works perfectly in emulator, not at all on an actual iPad

  • June 13, 2011
  • 4 replies
  • 3086 views

I've cross posted this question to several forums, to twitter, and to adobe support portal several times over the past week and no one has been able to help, so I'm sorry if you've read this somewhere else already, I'm just getting a little desperate and I'm not sure who to ask.

I'm new to mobile development, so I'm really hoping I am doing some simple wrong, like a wrong checked box or something, and not that the AIR for iOS packager just doesn't work like it's supposed to.


I  have an app that I have written for iPad. It's fully functioning when I  run it through the emulator (I have to change it to Flash 10.1 and use  Device Central because nothing else will accept touch events) but  doesn't really work on the iPad. Some of the features work, and some  don't. It's like it's just not quite compiling all the code, and I'm  very confused.

There are multiple classes interacting with each other to create a puzzle based game. I can create new puzzle pieces, but they won't lock into place. They also won't highlight correctly and the name of each piece won't pop up. And every time I publish it, something different is wrong with it. It's  like the compiler just can't quite get all the pieces to function  together. One time I'll install it and the pieces will light up  incorrectly but still lock into place. Another time they won't lock and  the names won't display. Another time the names will display but they  won't move around the screen correctly. I have no idea what's going on. It runs perfectly in the Device Central emulator.         

I've tried publish testing using AIR for iOS (even though the app won't function at all in that debugger because it uses touch events) before I published to my iPad. Still doesn't work.

My publish settings:

Player: AIR for iOS (AIR 2.6)
Script: Actionscript 3.0
Included .swf, .xml, and all relevant .as class files (I also tried only including .swf and .xml files)
Published using quick publish for device testing

Are there some AS 3.0 features that won't work in iOS? If so it would be really great to have a list of those somewhere.

What am I doing wrong? Why won't my app work on an actual device if it tests perfectly in the emulator?

Thank you!

This topic has been closed for replies.

4 replies

AmbariAuthor
Inspiring
August 29, 2011

I am going to copy and paste this answer into all of the forums I've  asked this question in case some noob like me comes along and needs the  answer.

I  found the problem! After 3 months I finally figured out what was wrong  and why my app was working in Device Central when exported as Flash 10.1  and not on my iPad when exported as AIR for iOS.

The  problem is that in the Flash runtime, if a line of code returns a bug,  the flash runtime says "Error, shmerror, try again next time." So I had  one if, else statement that was executing when it wasn't supposed to be -  only once, at the very beginning of the program. It was throwing an  error. When I exported as Flash, flash didn't care, and still executed  the code later when it was supposed to. But Apple won't let their  programs crash. So instead of just trying that code again, Apple  decided, after the first error was thrown, that it would then COMPLETELY  IGNORE that line of code. So the error was in the line where the states  would unhighlight themselves. Apple just shut down that line of code,  that's why it wouldn't execute properly.

I ended up changing this line of code

if (lastObjOver != null && lastObjOver.isLocked == true)

which threw an error when the piece was FIRST dragged over the puzzle, to to this

if (lastObjOver.parent != null && lastObjOver.isLocked == true)

which wouldn't throw the error.

Problem solved!

If  anyone else is having this problem, I suggest you do what I did. Change  all your touch events to mouse events so you can run the program in the  adc debugger. That's when I discovered the error being thrown.

AmbariAuthor
Inspiring
August 4, 2011

I am bumping this to see if anyone can help...it's been a month and I'm still completely lost, I have no idea what's wrong. Thanks!

AmbariAuthor
Inspiring
June 30, 2011

Just giving this a bit of a bump, see if anyone can help me out. Thanks!

Participating Frequently
July 4, 2011

Hi,

Could you please send us the sources at sanika@adobe.com?

Thanks,

Sanika

relaxatraja
Inspiring
June 14, 2011

External swf with script will not work.

Participating Frequently
June 14, 2011

Hi,

Could you run the swf on desktop in mobileDevice profile to see if you are using any APIs which are not available on iOS?

-Sanika

AmbariAuthor
Inspiring
June 14, 2011

@Sanika I can't test it on anything but device central because it uses touch events. It won't react in any other emulator. When I try to test it using AIR for iOS and the mobile profile it doesn't do anything - even less than it does on the actual device, it literally does nothing because I'm using a mouse. So I don't think I can do that.