We have an App built with a static Lib we are also building for distribution. The App and Lib run fine in Xcode debugger or when loaded on the device by Xcode debugging sess
Debug, by loading with the Xcode debugger, your Production build (probably set to Release Build with very different optimization and code gen settings than the Debug build you are currently testing with).
I had a similar problem and tried changing the project build settings, but it didn't work for me. Eventually solved my problem by changing the compiler optimization level setting for the release:
In Build Settings, go to the LLVM compiler 4.2 - Code Generation section, look for the Optimization Level option and change the Release setting from Fastest, Smallest [-Os] to None [-O0].
Hope this helps!
The chance is very high that your build settings are different between AdHoc (Release) and Debug. Did you double-check all build-settings values? Especially look at the ARC (automatic reference counting) settings.
Figured it out!! after 4 days of banging heads on desk. We don't know exactly why it works but it does. In case it's helpful to others here are the settings that resolved it for us. Set these in the "Deployment" section of the Static Library Project's Build Settings:
SET "STRIP LINKED PRODUCT" (STRIP_INSTALLED_PRODUCT) = NO
SET "STRIP STYLE" = DEBUGGING SYMBOLS.
We found this by trial and error but now notice that a few discussions online re setting up an Xcode project for building iOS static libraries use this setting. No discussion as to why, but there it is.
If anyone has any thoughts on why these lib settings fix it you might want to comment on it here.