How to link a iOS4-only static library without breaking my app on iOS3.x
I have an iPhone app that I still support on iOS3.1. I'm trying to add a new feature that requires a third-party static library with a requirement of iOS4. When I link my app to the static library it works fine on iOS4 but fails to start on iOS3.1 because of missing symbols (NSCache) from the sta开发者_运维百科tic library.
Is there any way to conditionally link the static library so that it loads under iOS4 but not under iOS3?
Actually there is.
First you will have to conditionally load the library. for that, on other link flags, you will create specific libraries load for each architecture/OS version. You can do that on linking menu on build settings from target.
Make sure to have weak linking on the libs, and not to use -load_all flag for the 3.x ios versions.
精彩评论