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
  • 2 replies
  • 2584 views

I'm new to mobile development, so I'm hoping I am doing some simple wrong, like a wrong checked box or something.


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 Emulator 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.

My publish settings:

Player: AIR for iOS
Script: Actionscript 3.0
Included .swf, .xml, and all relevant .as class 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?

This topic has been closed for replies.

2 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.

Known Participant
August 29, 2011

Thanks for posting this as you did. I am having issues when compiling in Air, and although my issues are probably different than yours, reading your process to solve them helped me.

e

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!

chris.campbell
Legend
August 4, 2011

Forwarding along to our iOS team for their review.

Thanks,

Chris

Participating Frequently
August 5, 2011

Hi,

I am sorry you are running into this problem. There are a few things you can try:

1) Run the application on Desktop in mobileDevice profile. You should be able to see exceptions for the  classes that are not supported on mobile devices. TO do this, find ADL in your CS 5.5? installation( It should be at /Applications/Adobe Flash CS5.5/AIR2.6/bin) and run ./adl -profile mobileDevice -screensize iPhone <path to application xml>.

2) There are a few classes which are not supported on iOS. You can check for isSupported property of classes before using them on iOS. For example, DatagramSOcket.isSupported will return false on iOS.

3) Are you loading any swf which contains actionscript code using loader? This does not work on iOS.

If you can share the sources, I can take a look. You can send them to me at sanika@adobe.com

Hope this helps.

Thanks,

Sanika