0

I'm facing quite "mysterious" problem. My App works fine with all build configurations on devices running iOS 4.x, but it crashes on iPhone running iOS 3.x immediately after launch, but only when compiled with Release configuration. With Debug config it runs with no problems, though.

I've spent a lot of time investigating possible cause of this, but was not lucky so far. I'm using XCode 3.2.4 with base SDK iOS 4.1, using LLVM GCC compiler. According to crash log, app crashes on very first line of code in applicationDidFinishLaunching: method implementation, where nothing but simple [[SomeObject alloc] init] is called, reporting EXC_BAD_ACCES, indicating that alloc method didn't allocate the instance correctly (?).

When I switch to GCC 4.2 compiler, crash log reports completely other place of crash origin, but I assume this is quite the same...

I suppose I'm missing some compiler or linker flags or so, but cannot find out which. I've tried all suggested solutions I've found so far, but nothing helps.

Thanks for any help.

Matthes
  • 515
  • 5
  • 12
  • posting the code that is causing the crasher would help. – TomH Sep 24 '10 at 13:23
  • Hm, that's funny, because even when I remove/comment out "problematic" piece of code, it simply crashes on very next instruction. It looks like it doesn't allocate data structures or, maybe more likely, classes are not recognized properly or whatever. Getting mad about it... – Matthes Sep 24 '10 at 14:04
  • After further investigation I've found that it maybe has something to do with 3rd party libraries or perhaps how it's linked. It seems that it crashes on calls to classes from such a library. Any ideas, please? – Matthes Sep 24 '10 at 17:42

1 Answers1

1

Are you using the LLVM compiler for the release build? In my experience, the LLVM compiler will weakly-link the API calls. This allows a 3.x app to run even if it has 4.x API calls as long as those calls are never executed. 3.x Apps compiled with GCC will crash on launch when the dynamic loader tries to resolve the 4.x APIs.

Cory Pratt
  • 81
  • 2