有条件地包含不同 iOS SDK 版本的库?

时间:2023-03-23
本文介绍了有条件地包含不同 iOS SDK 版本的库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我确信这有一个简单的答案,但它难住了我:(

I'm sure this has got a simple answer, but it's stumping me :(

我正在尝试构建一个可以在 iOS 4.3 和 5.0 上运行的应用程序.我对在运行时使用 -respondsToSelector 检查功能的想法很好,但为了使用 Twitter 功能,我需要包含 Twitter 库.

I'm trying to build an app that will run on iOS versions 4.3 and 5.0. I'm fine with the idea of checking for capabilities at runtime with -respondsToSelector, but in order to use the Twitter functionality I need to include the Twitter library.

这会导致编译器在构建 4.3 时失败,这是我所期望的.根据 Apple 文档(在 this page),可以有条件地链接框架 - 但我一生无法弄清楚如何设置其他链接器标志来执行此操作.谁能告诉我这是怎么做到的?

That causes the compiler to fail when building for 4.3, which I'd expect. According to the Apple docs (at the very bottom of this page), it's possible to link frameworks conditionally - but I cannot for the life of me figure out how to set the Other Linker flags to do this. Can anyone tell me how this is done?

推荐答案

在你的 Target -> Build Settings 中,搜索 Other Linker Flags 并点击发布类型(Debug 或 Release),然后在右下角点击添加构建设置 -> 添加条件设置,这将为您提供 SDK 弹出窗口以及指定任何其他标志的能力.

In your Target -> Build Settings, search for Other Linker Flags and click on the type of release (Debug or Release) and then on the bottom right, click Add Build Setting -> Add Conditional Setting and that will give you the SDK popup and the ability to specify any additional flags.

这篇关于有条件地包含不同 iOS SDK 版本的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

上一篇:从底部加载 UITableView 下一篇:来自表视图控制器的多个 segue

相关文章