Adding a static library to an XCode 4 project breaks "build and archive" feature
I built a static library with MGTwitterEngine and some OAuth / TouchJSon libs. Then I added that within the main XCode proj of an app.
I'm having trouble with this feature of XCode (build and archive). After I added the libs, the "build and archive" no longer generates a .IPA
Do you know a good tutorial to make some proper use of this 开发者_开发知识库archive feature ?
What should I do within the XCode Projet to make sure it will work correctly with my static libs ?
ps: The second is the most important to me.
Thanks in advance ;)
You should change your static library's "Build Settings", make sure Skip Install
is set to YES
If still not work, check your static library's "Build Phases", make sure:
After that, your Archive should be OK. But if your Xcode start to report who can not find your static library's .h files, you can just add them into your project as references, or change your project's "Build Settings", let it find your .h files in your static library's folder.
According to the Apple engineers, you should not use the "Copy Headers" build phase with static libraries on iOS - it's only intended for dynamic libraries (oddly using "Copy Headers" works fine for most cases, but definitely breaks the 'Archive' case).
Instead add a "Copy Files" build phase, setup like this:
If you are using the static libraries template, this build phase should already be present.
Drag all the header files that should be exposed into this section.
You also need to see "Skip Install" for the library to yes as other people have answered.
The video for WWDC 2012 Seassion 408 "Working with Schemes and Projects in Xcode" covers this from timestamp 45:18.
精彩评论