将特定于 SDK 的框架添加到 Xcode

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1409500/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 18:49:45  来源:igfitidea点击:

Adding SDK-specific frameworks to Xcode

iphonexcode

提问by Haentz

Xcode 3.2 kind of broke the build process of my iPhone app. I need to add a new framework to my project (MediaPlayer.framework).

Xcode 3.2 破坏了我的 iPhone 应用程序的构建过程。我需要向我的项目 (MediaPlayer.framework) 添加一个新框架。

So I go into my Target settings and try to add it to the "Linked Libraris" by hitting the [+] button. In the list the MediaPlayer.framework is missing, as well as other frameworks, such as UIKit, CoreGraphic and others. Some frameworks are still there.

所以我进入我的目标设置并尝试通过点击 [+] 按钮将其添加到“链接的图书馆”。列表中缺少 MediaPlayer.framework 以及其他框架,例如 UIKit、CoreGraphic 等。一些框架仍然存在。

I can add the frameworks by adding the SDK-specific ones (going into /Developer/Platforms/iPhoneOs.platform/...yadayadayada../frameworkd/) but then of course I can only compile for the iPhone platform and not for the simulator any more.

我可以通过添加特定于 SDK 的框架(进入 /Developer/Platforms/iPhoneOs.platform/...yadayadayada../frameworkd/)来添加框架,但当然我只能为 iPhone 平台编译,而不是为模拟器了。

So basically I wonder how I can get Xcode back to chose the appropriate framework, depending on platform and SDK version for me?

所以基本上我想知道如何让 Xcode 重新选择合适的框架,这取决于我的平台和 SDK 版本?

Thanks and kind regards, Hans Schneider

谢谢和亲切的问候,汉斯施耐德

Edit: Things I tried: Setting the Base SDK to 3.0 (was still 2.2.1), reinstalling 3.0 iPhone and Simulator SDK from the "packages" directory of the Xcode 3.2 DMG. Didn't help. The frameworks still wont show up in the list...

编辑:我尝试过的事情:将 Base SDK 设置为 3.0(仍然是 2.2.1),从 Xcode 3.2 DMG 的“packages”目录中重新安装 3.0 iPhone 和 Simulator SDK。没有帮助。框架仍然不会出现在列表中......

Edit 2: Ok, I now have the frameworks back in the list, I was previously in my AdHoc configuration. In Debug I have the frameworks back. But it still wont compile for the Simualtor (lots of Symbols(s) not found errors). Looks like the linker doesn't choose the correct libraries and always uses the iPhoneOs3.0 path for the frameworks.

编辑 2:好的,我现在将框架重新添加到列表中,我之前在我的 AdHoc 配置中。在调试中,我恢复了框架。但它仍然无法为 Simualtor 编译(很多符号未找到错误)。看起来链接器没有选择正确的库并且总是使用框架的 iPhoneOs3.0 路径。

回答by Mike Chen

Goto 'Framework Search Path' in build section in target's property.

转到目标属性的构建部分中的“框架搜索路径”。

Add path:

添加路径:

$(SDKROOT)/Library/System/Frameworks

Then it should work well.

那么它应该运行良好。

And once you press 'OK', you should be able to see the path is set to '/Library..."

一旦你按下“确定”,你应该能够看到路径被设置为“/Library...”