Say one thing first: there's one thing in Xcode called targets, and Apple's official document says:
A target specifies a product to build and contains the instructions for building the product from a set of files in a Proj ECT or workspace. A target defines a single product; It organizes the inputs into the build system-the source files and instructions for processing those source files-required To build that product. Projects can contain one or more targets, each of the which produces one product. (Omit several words)
A simple translation comes with a target detailing the product to be built, including the instructions in a project or working directory, which may seem unclear. Google search, found that the target of the explanation is still good:
A Target basically defines what's it is you building and the is building it. You can add more targets if you would like to build more than one thing. This usually makes sense if you need to build several related things from the same project. For instance, might want one target for a full, paid version of a application, and another target for a reduced, free Version of an application. Both targets would include much of the same code and resources, but some of the settings would is different and you might There are different files included with each.
This means that if you want to divide an application into a paid full version and a free lite version, most of the two versions are the same, and only the individual settings and the files contained are different, you can build a application and then get two targets corresponding to two versions respectively.
Here's a simple example to illustrate the problem with iOS7.0 and iOS6.1 (and the lower version) (with the xcode5.0, which has 6.1 and 7.0 two versions of the SDK)
To create a new project, the default development Target,base SDK and the emulator version are all 7.0, written in the Didfinishlaunchingwithoptions method in Appdelegate
- Self. Window. tintcolor = [Uicolor redcolor];
Then run, so there is no error. The next step is to change the version of the development Target,base SDK and emulator to 6.1 (note that the default Xcode does not have a 6.1 SDK and needs to be imported separately). Then run, you will get an error:
That is, the Tintcolor property is not in iOS6.1 at all, and it will be wrong at compile time. It is no use to add a judgment statement at this time, the error is still
- if ([[[[Uidevice Currentdevice] systemversion] Floatvalue] >= 7. 0) {
- self. Window. tintcolor = [Uicolor redcolor];
- }
This can only be done with preprocessing statements, so write:
- #ifdef __IPHONE_7_0
- if ([[[[ Uidevice Currentdevice] systemversion] Floatvalue] >= 7. 0) {
- self. Window. tintcolor = [Uicolor redcolor];
- }
- #endif
This will not be an error when compiling ... This is because there is a Availability.h file underneath the usr/include under sdk6.1, which defines a bunch of macros, including the iphone
- #define __IPHONE_2_0 20000
- #define __iphone_2_1 20100
- #define __IPHONE_2_2 20200
- #define __IPHONE_3_0 30000
- #define __iphone_3_1 30100
- #define __iphone_3_2 30200
- #define __IPHONE_4_0 40000
- #define __iphone_4_1 40100
- #define __iphone_4_2 40200
- #define __iphone_4_3 40300
- #define __IPHONE_5_0 50000
- #define __iphone_5_1 50100
- #define __IPHONE_6_0 60000
- #define __iphone_6_1 60100
- #define __IPHONE_NA 99999/* Not available */
And there's a sdk7.0 inside.
- #define __IPHONE_7_0 60100
So...... Not much to explain ...
ios-version Adaptation-sequel