views:

44

answers:

3

the app I've installed on an iPhone 3G device periodically crashes. I'm wondering if it's the device or the code. the code works fine on the simulator.

I have other apps from the app store that do the same thing. e.g. the stackoverflow app - whenever I do a search the app crashes. I've even had the iPod app crash too.

I've restored the phone a few times and still the same thing. I'm getting ready to upload the app to the app store and was wondering if anyone had any tips to make sure that my code is not the problem. it's difficult to tell because there are no errors in the simulator or memory leaks in Instruments

thanks in advance.

+3  A: 

You can be guaranteed that it is your code. Run it in the debugger on the device and see where it is crashing. If you are getting EXC_BAD_ACCESS use the following to help track it down

http://www.cocoadev.com/index.pl?NSZombieEnabled

Liam
+2  A: 

Are you sure you are not running out of memory? the easiest way to see if this is your problem is to implement didReceiveMemoryWarning method of your controllers and check if they are called. In the simulator you can simulate a memory warning but I am not sure if even in simulator app will crash if memory is not released. (I believe not)

Also run your app with instruments, using allocations: Run > Run with performance tools > Allocations. And use your app for a while and you will see. ;)

nacho4d
I second the memory thing. The iPhone 3G has almost NO memory. The iPhone 3Gs has about 5x more for your app. You want to test on an iPhone 3G for sure, its the most punishing thing.
Tom Andersen
No leaks does not mean that you are not burning through lots of memory. You only get 5MB sometimes on a 3G.
Tom Andersen
+2  A: 

It most certainly is your code that crashes.

Run in debug mode and watch the console (real debug mode, not only the debug target).

Also, you can (and should) grab the crash report from the organizer. You can also watch the device's console there.

Eiko