0

I am trying to add Stackmob SDK to an existing app and it crashes right after the app launches with EXC_BAD_ACCESS. The SDK works fine with any new project, but crashes my existing code. Adding the SDK consists of adding the actual SDK folder, adding frameworks, editing pch header file and adding -ObjC value for Other linker flags in Build settings.

The last step actually makes the app crashing. I am not sure if the SDK conflicts with any other library. I use SBJSON and 2 small helper classes beyond my own code. It's iPhone only, iOS 7.0.3, Xcode 5.0.2. Any idea what may cause the issue or how to adjust my settings? Thank you.

Martin Koles
  • 5,177
  • 8
  • 39
  • 59
  • Enable an Exception BreakPoint and see where its crashing. The -ObjC flag instructs your binary, when it launches, to load each category in included libraries immediately. Probably one of those categories has its own "+(void)load" method, and its doing something there that causes the crash. More likely you forgot to include a library that Stackmob depends on. – David H Dec 02 '13 at 13:04
  • I tried an Exception BreakPoint and it does not provide any more insight into the issue. The app crashes on the same place as without the breakpoint - main thread, 10 main - looks like it is not caught. I do add just the StackMob-v2.2.0 folder, which includes header files and libstackmob-v2.2.0.a archive, so it is pretty straightforward and I don't see where should I be doing something wrong. It works fine on any new project I start from scratch. – Martin Koles Dec 02 '13 at 13:41
  • I've had similar issues and for me it just takes a lot of time comparing the good project with the crashing one, comparing targets, trying to find the one difference. Good luck! – David H Dec 02 '13 at 14:42
  • Ensure you added all the correct frameworks. Also, try installing the SDK using CocoaPods. If this is an issue with dependencies CocoaPods might handle it automatically. – msv Dec 02 '13 at 19:32
  • Thanks for all your comments. Looks like I found the issue through elimination and the app does not crash anymore. At least for now :) In one of subviews I was creating a new NSManagedObjectContext with concurrency type NSMainQueueConcurrencyType and then I set it to be child of the main appDelegate MOC, which is also of MainQueuType. Looks like I was intending to fetch asynchronously here, but then left it on the main thread and Stackmob had some issues with that. – Martin Koles Dec 03 '13 at 09:08

0 Answers0