Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the correct way to set build configurations in an ios project using static libraries for creating an archive in xcode 4?

Tags:

xcode

ios

xcode4

I have a working application which relies on several static libraries, which I've added as dependencies to the application and added to the link with static libraries bit in build phases. Everything builds and runs fine in the simulator and on my attached iPad.

I wanted to create an .ipa for use with test flight so I followed the instructions on test flight's site (http://support.testflightapp.com/kb/tutorials/how-to-create-an-ipa-xcode-4) and some other tutorials relating to creating an archive with an app that uses static libraries (http://diaryofacodemonkey.ruprect.com/2011/03/18/ad-hoc-app-distribution-with-xcode-4/, http://www.musicalgeometry.com/?p=1237).

Following these tutorials, when I create an archive I get linker errors about not being able to find various libraries, for example: ld: library not found for -lOAuthTouch

(I've also tried using a new project and a new static library project to make sure it's not some setting I've changed and I get the same problem).

This seems to be because I added a build configuration called "Ad Hoc" to my app for creating an archive, and based on the linker command and the fact that adding an "Ad Hoc" configuration to all the static libraries I use allows the archive to be created I'm assuming that the static libraries are being built to a different directory.

I'd rather not have to add a new build configuration to all the libraries I use, so my question is, what should I do to create an archive of my app without tinkering with every library I use?

A second related question: all the tutorials I mentioned say to set the "Skip install" build setting to yes for static libraries, but the Apple documentation (http://developer.apple.com/library/mac/#documentation/ToolsLanguages/Conceptual/Xcode4UserGuide/DistApps/DistApps.html) seems to indicate setting it for the application, rather than the libraries. Anyone know which is right?

like image 418
Daniel Avatar asked May 11 '11 01:05

Daniel


People also ask

What is static library in iOS?

A static library is a collection of compiled object files combined into a single library file, that may be linked into an app or framework target just like single object files are linked.

Is XCFramework static or dynamic?

An XCFramework can be either static or dynamic and can include headers.


1 Answers

It will work, you must simply get the paths correct and make sure you have set Skip install to NO on each of the static libraries in the workspace. I recently went through this and ended up deleting the existing Ad hoc distribution configuration from both my main target and each of the static library targets. The I created a new ad hoc configuration on the main project and each static library project and verified all of the settings in each of them.

See this link, this, and this all of which helped with sort through this.

like image 60
FluffulousChimp Avatar answered Nov 15 '22 04:11

FluffulousChimp