[Resolved] EXC_BAD_ACCESS (SIGBUS) crash

My app is now feature complete but unfortunately one of the features is random crashs :frowning:

Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000001e
Crashed Thread: 0

  1. I am using the physics engine.
  2. The crash can happen on the first level of the xx level with no obvious pattern.
  3. It can sometimes happen on the menu screen between levels.
  4. It apparently happens quite often on a touch event but not exclusively.

I have looked at other threads on similar subjects and have tried to make sure I am using the physics engine correctly but am now at a loss as to how I can track down and fix the cause of this.

Any advice on a way to proceed would be much appreciated. [import]uid: 51494 topic_id: 25846 reply_id: 325846[/import]

Hi Gareth,

I’d try some print statements and viewing the console in Xcode while playing on device to start with.

Try commenting out some stuff, testing, if it works you have isolated the issue - if not you try commenting out another chunk of code.

Often this stuff is related to physics so it would pay to double and then triple check that you aren’t doing anything you shouldn’t, particularly playing with objects before collision is resolved. (Moving, removing, etc.)

Peach :slight_smile: [import]uid: 52491 topic_id: 25846 reply_id: 104615[/import]

Thanks Peach.

I’m sure I’ve done something stupid somewhere but I’m ****** if I can find it.

I guess commenting out to bare bones then re-adding the code is the way ahead but it such a pain as it only happens on the device.

Well it’s the weekend now so that’s a job for Monday.

Thanks again.

Gareth [import]uid: 51494 topic_id: 25846 reply_id: 104797[/import]

Hey Gareth,

I know it’s always a drag but at least when you isolate it you’ll feel good about it :slight_smile:

Good luck, let me know how you get on.

Peach [import]uid: 52491 topic_id: 25846 reply_id: 104835[/import]

Well suprise, suprise, the issue was my flakey code! I was originally using the end of a certain animation to trigger the end of level but swapped it out for a transition instead. Unfortunately I left the commented code in place and had accidently uncommented it at some point.

This set up a ‘race condition’ which never materialised in the simulator (presumably due to the speed with which it could process code) but on the device both events triggered so I was trying to remove the same object twice and kaboom.

I’ve been testing all day on the device and no crash so I’m pretty stoked.

Thanks for the help Peach.

Regards,

Gareth [import]uid: 51494 topic_id: 25846 reply_id: 106640[/import]

That’s fantastic news! Really happy to hear you were able to isolate and solve the problem :slight_smile:

Marking as resolved! [import]uid: 52491 topic_id: 25846 reply_id: 106674[/import]