App crashes in simulator

Hi, I’m getting mad with this bug in my app, it randomly crashes corona simulator and no error in the console is displayed.

This is all I get, an apple crash dump, don’t know if it’s my code or maybe some issue with the version, etc… I´m using lion 10.7.3, any help is appreciated!.

Corona Version: 2011.704 (2011.12.8)
[text]
Process: Corona Simulator [2314]
Path: /Applications/CoronaSDK/Corona Simulator.app/Contents/MacOS/Corona Simulator
Identifier: com.anscamobile.Corona_Simulator
Version: 2011.704 (2011.704)
Code Type: X86 (Native)
Parent Process: java [2156]

Date/Time: 2012-04-13 23:55:42.883 +0200
OS Version: Mac OS X 10.7.3 (11D50)
Report Version: 9

Interval Since Last Report: 3478447 sec
Crashes Since Last Report: 305
Per-App Interval Since Last Report: 923489 sec
Per-App Crashes Since Last Report: 138
Anonymous UUID: CDBE9E10-2005-4B59-850D-84793738DAE8

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000010

VM Regions Near 0x10:
–> __PAGEZERO 0000000000000000-0000000000001000 [4K] —/--- SM=NUL /Applications/CoronaSDK/Corona Simulator.app/Contents/MacOS/Corona Simulator
__TEXT 0000000000001000-000000000010d000 [1072K] r-x/rwx SM=COW /Applications/CoronaSDK/Corona Simulator.app/Contents/MacOS/Corona Simulator

Application Specific Information:
objc[2314]: garbage collection is OFF
[/text]

NOTE: I didn’t put any code because I really don’t know where’s crashing :confused: [import]uid: 8933 topic_id: 24820 reply_id: 324820[/import]

Is this only your own app?

Are you using physics? It would help to let us know what kind of things are happening when the crash occurs. [import]uid: 52491 topic_id: 24820 reply_id: 100767[/import]

Hi Peach!, it seems to be just mine. No physics involved in the app, I think is something related with the touch event as my app is heavy based on that, but I cannot tell for sure as the only thing I have is what I wrote above…

It has to be something related with the touch in this function, thank for your support :wink:

[lua] function playAreaArcade:touch(event)

local obj_1 = event.target.obj1
local obj_2 = event.target.obj2
local obj_3 = event.target.obj3

if Game.isPaused == false then

if (event.phase == “began”) then
display.getCurrentStage():setFocus(event.target, event.id)
t_touch[“bDoingTouch”] = true
t_touch[“beginX”] = event.x
t_touch[“beginY”] = event.y
end

if event.phase == “ended” then
local gesture
local gestoIncorrecto = true

t_touch[“endX”] = event.x
t_touch[“endY”] = event.y
– Llamada a chequear la direccion del gesto
gesture = self:checkSwipeDirection( event )

– Por implementar recuperar el objeto actual a tratar
if (event.target.obj1_swipe == gesture) then
gestoIncorrecto = false
if (self:gestoReconocido(obj_1)) then
obj_1 = nil
event.target.activeObjs = event.target.activeObjs - 1
event.target.obj_1 = nil
event.target.obj1_swipe = “CLEANSED”
end
end
if (event.target.obj2_swipe == gesture) then
gestoIncorrecto = false
if (self:gestoReconocido(obj_2)) then
obj_2 = nil
event.target.activeObjs = event.target.activeObjs - 1
event.target.obj_2 = nil
event.target.obj2_swipe = “CLEANSED”
end
end
if (event.target.obj3_swipe == gesture) then
gestoIncorrecto = false
if (self:gestoReconocido(obj_3)) then
obj_3 = nil
event.target.activeObjs = event.target.activeObjs - 1
event.target.obj_3 = nil
event.target.obj3_swipe = “CLEANSED”
end
end

if (gestoIncorrecto == true) then
event.target:dispatchEvent( { name=“gestoFallado”, target=event.target } )

end

if (event.target.activeObjs == 0) then
event.target:dispatchEvent({name=“touchAreaLimpia”, target=event.target })
end

t_touch[“bDoingTouch”] = false
display.getCurrentStage():setFocus(event.target, nil)
end
end
return true – Parar distribución del evento touch
end

function spawn(i_grupo)

local ySpawnPoint = -50

local touchGroup = display.newGroup()
currNumTouchGrp = currNumTouchGrp + 1
touchGroup.id = “Grupo_” … currNumTouchGrp

local touchArea = display.newRect(touchGroup, 0, -100, _W, 100 )
–Colorearla solo en fase de desarrollo
–touchArea:setFillColor(255,0,0)
touchArea.tipo = “Area”
touchArea.alpha = 0.1
touchArea:addEventListener(“touch”, playAreaArcade)
touchArea:addEventListener( “gestoFallado”, playAreaArcade)
touchArea:addEventListener(“touchAreaLimpia”, playAreaArcade)

local obj1 = Objeto:new(i_grupo.ObjLeft)
obj1.id = i_grupo.ObjLeft.id
obj1.isLocked = i_grupo.ObjLeft.locked
touchGroup:insert(obj1)
obj1:setReferencePoint ( display.CenterReferencePoint )
obj1.x = xmiddle1
obj1.y = ySpawnPoint
obj1:addEventListener(“touch”, obj1)

local obj2 = Objeto:new(i_grupo.ObjMiddle)
obj2.id = i_grupo.ObjMiddle.id
obj2.isLocked = i_grupo.ObjMiddle.locked
touchGroup:insert(obj2)
obj2:setReferencePoint ( display.CenterReferencePoint )
obj2.x = xmiddle2
obj2.y = ySpawnPoint
obj2:addEventListener(“touch”, obj2)

local obj3 = Objeto:new(i_grupo.ObjRight)
obj3.id = i_grupo.ObjRight.id
obj3.isLocked = i_grupo.ObjRight.locked
touchGroup:insert(obj3)
obj3:setReferencePoint ( display.CenterReferencePoint )
obj3.x = xmiddle3
obj3.y = ySpawnPoint
obj3:addEventListener(“touch”, obj3)

touchArea.obj1 = obj1
touchArea.obj2 = obj2
touchArea.obj3 = obj3

touchArea.obj1_swipe = obj1.gesture
touchArea.obj2_swipe = obj2.gesture
touchArea.obj3_swipe = obj3.gesture

touchArea.activeObjs = 3

playAreaArcade:insert(touchGroup)
table.insert(Game.activeTouchGroups, touchGroup)
Game.activeTouchSet:insert( touchGroup )
– Transition
tnt:newTransition(touchGroup, {time=1000, y = i_grupo.pos_Y, transition=easing.inOutExpo})
– onComplete= function(touchGroup)

– Score:restar_vida(touchArea.activeObjs)
– playAreaArcade:removeTouchAreaGroup(touchGroup)

– end })

end[/lua] [import]uid: 8933 topic_id: 24820 reply_id: 100774[/import]

What I would suggest at this stage is to comment out that function and see if the crash still happens, if it clearly doesn’t then try putting back in about 1/3 of the function and see if it crashes, if so work on narrowing it down further - if not, uncomment some more.

This way you will find the specific part of code responsible. [import]uid: 52491 topic_id: 24820 reply_id: 100949[/import]

Hi Peach, I just wanted to thank you for your kind advice, today was a family sunday so I couldn’t get into it. I will try to narrow the problem as you suggest, yesterday I did change some of the touch function, such as moving the references to the objects to the ended event phase but the problem persisted and I was tired to check code :).

Thank you again!. [import]uid: 8933 topic_id: 24820 reply_id: 101125[/import]

Glad to hear you are having a pleasant Sunday :slight_smile:

Let me know how you go when you get a chance to try as I suggested, I’m hoping it makes it fairly easy to fix the issue. [import]uid: 52491 topic_id: 24820 reply_id: 101179[/import]

Hi there!, thanks before anything I hope you had a nice day too Peach.

I thought to try my app on the device to see if it’s crashing in the same way but wen I uploaded and tried to run the app it gets a blank screen and the following console message:
[text]
Apr 16 17:07:43 iPhone-de-Rubs kernel[0] : launchd[7442] Builtin profile: container (sandbox)
Apr 16 17:07:43 iPhone-de-Rubs kernel[0] : launchd[7442] Container: /private/var/mobile/Applications/F87EE87D-258A-4E30-B734-772 [69] (sandbox)
Apr 16 17:07:43 iPhone-de-Rubs rubsApp[7442] : libMobileGestalt computeUniqueDeviceID: total time for bb to return imei: 0
[/text]
I’m using a development provisioning profile, I don’t know if I can only use ad hoc provisioning profiles with corona for testing purposes.

(My very first time deploying a corona project)

Here’s my build.settings file:
<br>settings = <br>{<br> iphone =<br> {<br> plist=<br> {<br> CFBundleIconFile = "Icon.png",<br> CFBundleIconFiles = {<br> "Icon.png" , <br> "Icon@2x.png" , <br> "Icon-72.png",<br> },<br> },<br> },<br>}<br>

Thanks in advance!.
David. [import]uid: 8933 topic_id: 24820 reply_id: 101290[/import]

build.settings is OK and you can build using dev provisioning when a trial user to test on device, that’s also fine.

Are you still getting the same issues in the simulator? I was hoping maybe you might have been able to narrow it down using the commenting, uncommenting, try, try again method :wink: [import]uid: 52491 topic_id: 24820 reply_id: 101459[/import]

Hi Peach, unfortunately I couldn’t narrow the problem, and added to the fact that I also couldn’t build to the test device, yesterday was a very, very, very frustrating day :/.

What I plan to do if my full time job allows me today, is to build a copy of my app and add module by module, I want to test out at least the basic gameplay in the device to take a breath of “progression” cause I’m getting upset with it atm. [import]uid: 8933 topic_id: 24820 reply_id: 101526[/import]

I understand the upset and frustration when things don’t work, believe me. Early on I nearly broke a laptop and I literally cried at one point, I was just that frustrated.

What happens when you first load the app? If you are using multiple screens (Director or Storyboard) then what is in main and what is in the screen you direct to immediately after main? [import]uid: 52491 topic_id: 24820 reply_id: 101547[/import]

Hi, I’m not using director nor storyboard, my main.lua right now looks like this:

-- GLOBAL CLASES (SINLEGTON)-  
  
require ("Game")  
require ("Score")  
require ("Menu")  
require ("GameEventView")  
tnt = require ("TransitionManager")  
  
-- GLOBAL VARIABLES --  
  
\_W = display.contentWidth  
\_H = display.contentHeight  
  
-- LOGIC INIT  
  
display.setStatusBar(display.HiddenStatusBar)  
  
Game:init()  
Score:init()  
  
local menu = Menu:new()  
menu:toggleBgrSound(true)  
menu:show("main")  

Menu will create a display group with two buttons (widget library) and from there a Game:play() method will first remove the menu and create the game view with the game’s logic.

I’m right now copying the project, and will load and build each of the class to see if I catch the bug.

A question comes to mi head related the build process, I’m using the iPhone configuration tool, I suppose that the result will be the same as if you install the app via Xcode as your guide states in the build forum, isn’t it? [import]uid: 8933 topic_id: 24820 reply_id: 101559[/import]

The result should be the same, yes.

At least your main is fairly tight so you should be able to work out which file is causing the problem with only a little commenting/uncommenting.

I know I can’t be as eager as you but still, I really, really want to see this get resolved - I know it sucks when you have to dig to find issues. [import]uid: 52491 topic_id: 24820 reply_id: 101590[/import]

Are you using ads by any chance?
[import]uid: 19626 topic_id: 24820 reply_id: 101605[/import]

Hi there!, a few lines just to say that I deconstructed my game, and then I just added the classes one by one.

At the time I had to get back on my duties (other job) I managed to get the halved game in my iPhone4 so really exited about it, fresh air for me leaving some frustration back.

When I arrive home I will keep on the reconstruction work and hopefully I will get with the both annoying bugs today.

@Rob not Ads yet, but I plan to add them because my game will be probably free, any advise to avoid extrange errors is very welcome!.

Thank you for your time Peach and Rob. [import]uid: 8933 topic_id: 24820 reply_id: 101618[/import]