Open grgcombs opened 12 years ago
OK, a little more info on the issue. As for the root cause of the crash, it's still unclear to me, but after iterating through the project history I've identified some factors that help introduce the problem.
The crash occurs after making the following changes to each of the "framework" and "sub-framework" library build settings:
DEAD_CODE_STRIPPING = NO;
STRIP_STYLE = "non-global";
COPY_PHASE_STRIP = NO;
However, even with these settings in place the crash is effectively eliminated if I convert RestKit's RKObjectIsValueEqualToValue() function into a class method.
So at this point, should I invoke the power of @blakewatters too? I'm baffled at how electing to not strip dead/debugging library code and would introduce such a crash. I would expect that these mysterious illegal instruction problems would be more prevalent if someone did strip such things when they shouldn't... Alas, my years at Metrowerks/CodeWarrior didn't prepare me enough for funky llvm compiler/linking craziness.
We're having the exact same problem! We found out the hard way - waiting for 8 days and Apple telling us about it. In our case we hid the Urban Airship static library inside the dependent project to hide it.
We found two workarounds:
I found this, which describes a bug in Xcode 4.3+.
"When performing an Archive action, Xcode uses the project-level build setting for STRIP_INSTALLED_PRODUCT rather than the target-level setting."
Is anyone else having issues with Bad Instruction: 4 crashes when deploying an app based on these iOS frameworks to the device via an IPA?
The crash only happens when you archive the app, sign it, and install it on the device. It does not occur when compiling for Release, or otherwise when it's convenient for the debugger to catch the problem. I'm spending hours on hours archiving, signing, installing the IPA, and symbolicating the resulting crash logs with hundreds of NSLogs for any debugging info. I'm drowning.
From what I can gather from several stack overflow posts, it would seem that it has to do with running any static C functions in sub-libraries.
So my application workspace and frameworks (via dependency) look like this:
Application Target:
Network and Data framework
-- RestKit as a framework (inside the network and data framework, in order to keep it unexposed)
All the frameworks have the same build settings. All of the frameworks are executing code successfully before the crash. Some of the RestKit framework methods work fine too, but it's a few seconds into the startup that it dies while mapping some JSON to Core Data (not all JSON to Core Data is problematic though, it's already mapped some successfully before the crash).