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

Conditionally including a library for different iOS SDK versions?(有条件地包含不同 iOS SDK 版本的库?)
本文介绍了有条件地包含不同 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 版本的库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Why local notification is not firing for UNCalendarNotificationTrigger(为什么没有为UNCalendarNotificationTrigger触发本地通知)
iOS VoiceOver functionality changes with Bundle Identifier(IOS画外音功能随捆绑包标识符而变化)
tabbar middle tab out of tabbar corner(选项卡栏中间的选项卡角外)
Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
How can I sync two flatList scroll position in react native(如何在本机Reaction中同步两个平面列表滚动位置)
Get an event when UIBarButtonItem menu is displayed(显示UIBarButtonItem菜单时获取事件)