Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to link different precompiled libraries for different build profiles in XCode for iPhone?

My client is providing me with two precompiled libraries, blah-device.a and blah-simulator.a. How do I tell xcode to use blah-device.a in Device compilation mode and simulator in Simulator compilation mode?

My client gives me these instructions

  1. Open the Targets group (in the Groups & Files panel), right-click the project icon, then select Add > Existing Frameworks.
  2. In the Linked Libraries section, click the Add Libraries icon (+) icon, then click Add Other.
  3. Select either blah-device.a (for developing directly on the iPhone device) or blah-simulator.a (for developing on the iPhone Simulator), then click Add.

I already copied the header file in there, however these instructions don't make building easy with different profiles.

How do I get Xcode to link blah-device.a when building with the DEVICE profiles and blah-simulator.a when building with the SIMULATOR profiles?

Any help is greatly appreciated.

like image 427
CVertex Avatar asked Nov 15 '09 06:11

CVertex


1 Answers

The easiest way would be to create two separate targets by duplicating your existing one. Name one "Foo Device" and the other "Foo Simulator." Then right-click on the blah-device.a in XCode, select the Targets tab and make sure the "Foo Device" target is checked ON and the "Foo Simulator" target is checked OFF.

Repeat for balah-simulator.a but this time "Foo Device" target is OFF and "Foo Simulator" target is checked ON.

Now whenever you want to do a simulator build make sure you select the Simulator from the Active SDK popup AND the "Foo Simulator" from the target popup. For device testing select Device AND the "Foo Device" target.

like image 131
Ramin Avatar answered Oct 19 '22 06:10

Ramin