How do you conditionally include a structure in an Xcode project?

Is it possible to have one Xcode project (and, ideally, one goal) that conditionally will include frameworks when building on a specific version of OS X / Xcode, but not include these frameworks when building against another version?

I would like to start adding El Capitan support to the application I'm working on, but some of the support that I have in mind require linking to frameworks that are not in Yosemite. Is there a way to configure an Xcode project so that the same project can be built under 10.11 / Xcode 7 with frameworks, but also be created under 10.10 / Xcode 6 without frameworks (and without error)?

I know how to check for the presence of a class or method at runtime, but it is not clear to me how I manage frame binding without creating a second Xcode project, a second source control branch or always creating against Xcode 7 (none of which I want to do yet )

+4
source share
1 answer

The โ€œdifferent versionโ€ will essentially be different target- it will set up this way of doing exactly what you are asking for. A basic example is simply right-clicking on an original target and selecting duplicatefrom current goals; then make any changes to the framework bindings in the section Build Phases.

Goals

In the "Complex phases" you will notice that I have linked three frameworks with my original goal:

original

-:

enter image description here

MyApp , , , . , , Deployment Target (, OS X), , , SDK ..

, , , - .

+2

Source: https://habr.com/ru/post/1598063/


All Articles