开发者

Adding a static library to an XCode 4 project breaks "build and archive" feature

开发者 https://www.devze.com 2023-04-06 00:20 出处:网络
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 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

Adding a static library to an XCode 4 project breaks "build and archive" feature

If still not work, check your static library's "Build Phases", make sure:

Adding a static library to an XCode 4 project breaks "build and archive" feature

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:

Adding a static library to an XCode 4 project breaks "build and archive" feature

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号