kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 473 forks source link

Runs fine in simulator, but crashes on device #46

Open DeweyOx opened 12 years ago

DeweyOx commented 12 years ago

Using a Fake framework, compiles OK, but when the framework is placed into another project, that project runs perfectly in the simulator, but throws a EXC_BAD_INSTRUCTION when trying to run a method in the framework. Allocating a class in the framework seems to work ok, but running a method on it crashes.

Is there a setting or something I'm missing when creating the framework that will ensure it works on a device? The framework project has armv6 and armv7 architectures in the build settings (I'm also using the latest code, downloaded today).

Any ideas would be greatly appreciated.

DeweyOx commented 12 years ago

I've narrowed it down to crashing on this line:

size = CFSwapInt16(size);

The core foundation headers are included in the framework, any idea why this would crash on a device only and not the simulator?

DeweyOx commented 12 years ago

Fixed this by using a Real Framework. Not sure how to only include the headers of an existing framework into your own framework. That was my issue. For reference, it would be good to explain how to do that. Copying the headers is easy and referencing them in your project is easy, but your resultant files then have broken references (#import "header.h" as apposed to "import <framework/header.h>).

kstenerud commented 12 years ago

Still looking into this... I may have to change the way fake frameworks are built again /=

DeweyOx commented 12 years ago

OK. Thanks for your help.

kstenerud commented 12 years ago

FINALLY tracked it down. Under build settings, set "Deployment Postprocessing" to No.

I'll update the templates for this later.