在Xcode 4.6中为模拟器构建静态库 [英] Build Static Library in Xcode 4.6 for Simulator

查看:62
本文介绍了在Xcode 4.6中为模拟器构建静态库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Xcode 4.6 上为模拟器构建静态库?

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

我已经尝试过" https://github.com/kstenerud/iOS-Universal-框架".但是在演示中使用该框架时出错.

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

错误就像:

ld:警告:忽略文件/Users/shuvo/test_lib/Demo(V.1)/myProject.lib/libMyProjectLibrary.a,在文件/Users/shuvo/test_lib/Demo(V.1)中缺少必需的体系结构i386 /myProject.lib/libMyProjectLibrary.a(2片) 体系结构i386的未定义符号: "_ OBJC_CLASS _ $ _ showScreen",引用自: ViewController.o中的objc-class-ref ld:找不到体系结构i386的符号 铛声:错误:链接器命令失败,退出代码为1(使用-v查看调用)

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)

推荐答案

我遇到了同样的问题,并通过在方案编辑器中将静态lib的运行配置设置为Release来解决.

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

这是iOS-Universal-Framework文档中构建iOS框架"部分中的文字:

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

步骤2.(可选)在方案编辑器中设置运行"配置. 默认情况下将其设置为调试",但您可能需要将其更改为 准备发布框架时释放".

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.

关键是构建设置"中的仅构建活动体系结构", 调试默认设置为NO

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

这篇关于在Xcode 4.6中为模拟器构建静态库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆