Build Static Library in Xcode 4.6 for Simulator

2019-08-09 07:31发布

How to build a static library for simulator on Xcode 4.6?

I've tried "https://github.com/kstenerud/iOS-Universal-Framework". But got an error while using that framework on demo.

Error is like:

ld: warning: ignoring file /Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a, missing required architecture i386 in file /Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a (2 slices) Undefined symbols for architecture i386: "_OBJC_CLASS_$_showScreen", referenced from: objc-class-ref in ViewController.o ld: symbol(s) not found for architecture i386 clang: error: linker command failed with exit code 1 (use -v to see invocation)

1条回答
Anthone
2楼-- · 2019-08-09 07:37

I came across the same problem,and solve it by setting the static lib's run configuration as Release in the scheme editor.

here is the words in the document of iOS-Universal-Framework, section "Building your iOS Framework":

step 2.(optional) Set the "Run" configuration in the scheme editor. It's set to Debug by default but you'll probably want to change it to "Release" when you're ready to distribute your framework.

the key is the "Build Active Architecture Only" in Build Settings, Debug is set to NO by default

查看更多
登录 后发表回答