views:

2394

answers:

3

I have two projects, a Cocoa iPhone application and a static library which it uses.

I've tested it successfully on the iPhone simulator, but when I try to deploy it to my iPhone device I get (symbol not found) link errors.

If I remove the dependancy of the library the project builds/runs fine.

I have made sure all the build settings are set to iPhoneOS not the simulator.

Im sure its something simple, but has anyone run into similar problems moving from iPhone simulator to device?

--EDIT: I have managed to create new projects (one for the application and one for the static library), and successfully get them to run on the iPhone or simulator. But I have a very strange problem... for each specific project I cannot get it working for BOTH the device and the simulator... I have double checked the build settings, made sure the libraries that are being references are for the matching build settings (I believe) but I cannot resolve these linking errors.

I think I must be doing something very wrong... all the apple documentation says 'its super simple - one click' but this is giving me a lot of problems.

This is probably something to do with xCode build settings, but I cannot seem to understand why selecting the different build platforms and rebuilding the libraries does not work.

+7  A: 

Check out my answer to a similar question for a link to an article that might help. There is a link to an interesting article.

Marc Novakowski
Thanks, I managed to get a new test project working using that article, although I still seem to be having problems when the static library is being created in a separate xcode project.
Akusete
+1  A: 

Eventually I realised what the problem was.

I changed my device target from simulator to iPhone device, then removed the old (simulator) static library and attached the new (device) library.

All fine, except the library search path (in the build configurations) still had the simulator directory listed first, which I assume cause it to be found and used rather than the device.

This also explains why I was able to make each setting work with a new project, but only had trouble changing between settings.

Its a simple and stupid problem, but one that caused me some grief and time. Im still not sure how to properly set target dependent build settings but at least if anyone is getting similar problems its something to look out for.

Akusete
+1  A: 

I've created a complete tutorial on how to create and use static libraries, this tutorial covers the the method that is also advised by apple, maybe people will find it usefull:

http://www.sodeso.nl/?p=822

Advantages of this methods is that it automatically recompiles the library according to your project settings (so no trouble with device / simulator builds)

ronaldmathies