Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static Libraries on iPhone device

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.

like image 824
Akusete Avatar asked Jan 24 '23 22:01

Akusete


2 Answers

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.

like image 163
Marc Novakowski Avatar answered Jan 29 '23 08:01

Marc Novakowski


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.

like image 35
Akusete Avatar answered Jan 29 '23 07:01

Akusete