开发者

Conditionally including a library for different iOS SDK versions?

开发者 https://www.devze.com 2023-04-11 23:22 出处:网络
I\'m sure this has got a simple answer, but it\'s stumping me :( 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

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

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 开发者_JS百科the Twitter functionality I need to include the Twitter library.

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?


You should also link the framework with the flag "Optional". You can set this at the "Build Phases" panel at the point "Link Binary With Libraries".

Conditionally including a library for different iOS SDK versions?

you can switch "Required" to "Optional"


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号