Trying to chase down crashes when running on device and/or xcode simulator

Hi,

I have an app (written using the Game Edition Beta) which runs fine in the Corona Simulator but I have some intermittent crashes on the Xcode Simulator and on the actual device.

  1. On the Xcode Simulator everything seems to run 100% including exiting the app (by press the home button) and then re-starting it (which restarts the app, no actual multi-tasking, which is fine by me). But sometimes (and only sometimes) the app crashes very shortly after startup. At first I thought it was something I had done in my code, but in the end I replaced the main.lua with something very simple and it still crashed. What I discovered is that if I delete the app from the Xcode Simulator and then re-build for the Xcode simulator it works fine again (for a while).

  2. On the device if I exit the app (with the home button) and then re-start the app, the screen appears as it was on exit and then the app crashes. At this point, if you start it again, it run fine until the next suspension.

Has anyone got any clues on how I can find the cause of these errors… The main is basically ready to ship but point 2) makes it appear like poor software.

I will try playing with applicationSuspend to see if I can find a way around this.

Thanks,

Gary
PS. I am using a 3rd generation iPod touch with iOS 4.0, Xcode 3.2.3 and the Game Edition Public Beta. [import]uid: 4415 topic_id: 1905 reply_id: 301905[/import]

OK, I got to the bottom of this… The problem is with OpenFeint… By commenting out the call to openfeint.init the app now exits and re-starts OK… With OpenFeint included it crashes on the re-start as described above.

I will raise an issue now…

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5606[/import]

I have raised an issue for this: http://developer.anscamobile.com/issues/1906

Is there any update? Will this be fixed in the V2.0 release (September 15th)??

This is the ONLY bug which is stopping me from releasing my latest game (and my first with OpenFeint integration) for the iPhone, I could release it without OpenFeint but I don’t really want to do that.

Thanks, Gary [import]uid: 4415 topic_id: 1905 reply_id: 5676[/import]

Oh I forgot something else…

The simulator problem (point 1 in original post) seems to occur with ALL apps, not just one… To use the simulator I have to delete the app every time before I run the next build.

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5677[/import]

Hi Gary,
I created a simple app in Game Edition beta and built it for the XCode Simulator which seems to be working fine (code below). Try building this for your Simulator and see if you have the same problem. Could it be a setting in your build.settings or config.lua file?

-- main.lua  
  
local box1Width = 100  
local box1Height = 100  
  
local text1 = display.newText("height test", 0, 40, "Courier", 20)  
text1:setTextColor(255, 255, 255, 255)  
text1.x = display.viewableContentWidth/2  
  
local box1 = display.newRect(0, 0, box1Width, box1Height)  
box1:setFillColor(0, 200, 200, 255)  
box1.x = display.viewableContentWidth/2; box1.y = display.viewableContentHeight/2  
  
function growBox( event )  
 local t = event.target  
 local phase = event.phase  
  
 if "ended" == phase then  
 -- transition.to( t, { time=1000, width=t.width\*2, height=t.height\*2 } )  
 transition.to( t, { time=1000, height=t.height\*2 } )  
 end  
end  
box1:addEventListener( "touch", growBox )  
text1:addEventListener( "touch", growBox )  

[code]
– config.lua

application =
{
content =
{
width = 320,
height = 480,
scale = “zoomEven”
},
}
[/code] [import]uid: 8194 topic_id: 1905 reply_id: 5679[/import]

@dknell

Thanks for replying to my problem… This is very frustrating… Now the Xcode simulator is working fine for my projects and for the test project you listed above…

So for the moment, this one is closed… But the OpenFeint crashing is still a problem… I just tried a fresh build and got the same results!

Thanks, Gary [import]uid: 4415 topic_id: 1905 reply_id: 5680[/import]

Hi,

Is anyone else seeing this OpenFeint error… My apps is 100% ready to go, but I really, really want to ship it with OpenFeint enabled…

If others are seeing this problem then at least I know that it is a Corona bug and I can waiting until Ansca fix it… But if others aren’t seeing it… then… I have some work to do!

Thanks,

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5759[/import]

Also the Xcode simulator problem is back… The sample project above works but my apps don’t… I don’t have time to chase this one at the moment, so I am just deleting the apps every time and living with the pain.

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5760[/import]

Gary,
Not sure if this will help, but have you tried any other Corona-created games that have OpenFeint integration to see if they have the same problem as yours? You may want to try Doodle Dash. I have played it and it seems to be pretty stable. The only problem I’ve had with OpenFeint on that game is when you click on “View High Scores and Achievements” after canceling the OpenFeint login you only get a white Webpopup screen and you have to quit the game. But I think that’s a known bug.

Dave [import]uid: 8194 topic_id: 1905 reply_id: 5768[/import]

Dave,

Thanks for your reply… I haven’t tried Doodle Dash, but if it is a Corona game and it has OpenFeint, then I am guessing it works OK… I too have seen the white Webpopup screen problem, but at the moment, I can’t reproduce it…

My problem is this, the game works fine if I comment out the call to openfeint.init(). So I don’t know what to do next!

Of course we don’t know what version of Corona Doodle Dash is using… The problem with all this remote compiling is that we don’t know what changes Ansca as making in the background and what version of OpenFeint they are using at any one time.

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5776[/import]

Hi,

With regards to the OpenFeint crash… I thought I would try and move the call to openfeint.init() to different parts of the code in case the problem was either a race condition or some kind of memory/pointer problem.

At first I moved the require(“openfeint”) and the call to openfeint.init() to later on in the code, but this didn’t solve anything. Then I tried the following (and it worked):

I left the require(“openfeint”) at the beginning of the code and then (with the help of a boolean flag to avoid double initialization) I call openfeint.init() just before the calls to launchDashboard() or setHighScore().

And it works… Clearly there is an issue with openfeint.init() but this is a viable workaround for me…

OK, off to submit the app to the store now! Wish me luck!

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5806[/import]

@garysims – to be clear, you’re saying that the problem is calling openfeint.init() right after require(“openfeint”)?

It’s possible there’s a race condition, since the OpenFeint library is pretty big (the source is several hundred C++ files).

The “white screen” problem is a known bug, and is being worked on (still needs testing). [import]uid: 3007 topic_id: 1905 reply_id: 5882[/import]

@evank,

Just to clarify, the crash comes with the call to openfeint.init() but there doesn’t seem to be a link with its distance from the require(“openfeint”), more how long it is from calling openfeint.init() since the program was re-started by iOS4…

Remember this ONLY occurs when the app was already running, is left (using the home key) and is re-entered from the task manger (or by using the app icon). After the crash the next iteration works but the next will fail and so on… Almost like after the crash the app completely dies and it is like a fresh exec of the app, but when the home key is used the Apple multitasking stuff comes into play and that is when it crashes.

Also, I don’t think the race condition is within the OpenFeint library itself as if I call openfeint.init() late in the program and then immediately call launchDashboard() or setHighScore(), OpenFeint just goes into offline mode and then a few seconds later goes online.

It seems to me to be a race with Corona being re-started and a call to openfeint.init().

Thanks,

Gary [import]uid: 4415 topic_id: 1905 reply_id: 5890[/import]