Building a backwards compatible OS X app, when a new API is present?

后端 未结 2 1899
清歌不尽
清歌不尽 2021-01-02 10:45

I\'m trying to upgrade an app (Clarke) to provide 10.6 compatibility.

My plan is to use two different code paths depending on the version of OSX in use.

On

相关标签:
2条回答
  • 2021-01-02 10:48

    The Deployment SDK trick works only when you have the same framework on both platforms but new calls in the newer one. For CoreLocation, the entire framework is missing on 10.5, so your app will fail to load because it cannot dynamically bind to the framework.

    You need to do the above, plus add CoreLocation as a weak framework. Select your Link Frameworks and Binaries build phase, find CoreLocation in the Detail view, and in the middle column change "Required" to "Weak".

    When you build your app, Xcode will pass -weak_framework CoreLocation to the linker, and your app will load on all 10.5 and 10.6 systems regardless of whether CoreLocation is present. It's up to you to make sure not to call any CoreLocation methods unless you are actually running on 10.6, though.

    0 讨论(0)
  • 2021-01-02 11:09

    You should be able to solve this problem by changing the build settings of your target:

    1. Set the Base SDK to 10.6
    2. Set the Deployment SDK to 10.5
    0 讨论(0)
提交回复
热议问题