views:

30

answers:

3

I have a superweird problem:

I get a crash (EXC_BAD_ACCESS) when running my app with Release as active configuration on my 3.1.3 iPhone 3G. (works well in debug configuration or in simulator , works perfectly on device running iOS4).

My first guess was one setting in the Release configuration was erroneous/missing. In order to test it I just made a duplicate of my debug configuration and surprisingly I get the same error (although configuration is just a copy of the one working).

I don't understand why, with configurations that are supposed to be the same, one is working and not the other one.

If someone want to enlighten me, I am banging my head against the wall.

Thank you

NOTE: base SDK is 4.0 and deployment target is 3.0

A: 

Perhaps you have an unassigned local variable. Object-C follows how C does this. So in a release version you cannot assume that any local variable is initialised to 0 whilst in debug you can (in this case I would guess a pointer).

EDIT: Pass -Wuninitialized to the compiler (or better -Wall) for the compiler to warn on these Apple gcc man page Note only works if optimizer is on.

Mark
Thx. I already checked manually but there is a way to do it automatically
Thomas
I just recompiled with -Wuninitialized and spotted an uninitialized local variable. However this didn't solve my problem.Anyway my app works well in Release mode on device running iOS4. I get this crash only on iOS 3.1.3 (Release Mode)Thank you anyway
Thomas
A: 

You should check for memory leaks and handling of memory warnings. The amount of memory is probably the biggest difference between the environments you quote.

In another scenario I once found out that the simulator was faster, and therefore a certain race condition didn't show up, which did show up on the device. That's the second difference in the environments you quote: speed.

Try to pinpoint your crash and investigate from there. NSLog all didReceiveMemoryWarnings. Look for places where you made assumptions, i.e. about static information.

mvds
A: 

I fixed the problem.

It was three20 library fault. I had updated to the master branch that support iOS 4 but unfortunately this breaks support for 3.1.3. (thing that is not documented apparently)

Anyway I found this post that helped me to spot the problem. I just had to apply this patch and then I was able to run my project on 3.1.3 devices and iOS4 ones

Weird thing: why was it crashing when I was initializing a UIActionSheet (on a line of code not related at all with the Three20 lib)?

Thank you for your help.

Thomas