The targets option has the other linker flags set to fill in Xcode's linker parameters, such as:-O bjc-all_load-force_load.
Remember when we were learning the C program, the steps from C code to the executable file were:
Source code > Preprocessor > Compiler > Assembler > Machine code > Linker > executable file
In the final step, you need to link the. o file with the C language runtime, which requires the use of the LD command. After a series of processing of the source files, a corresponding. obj file is generated, and then a project will inevitably have many. obj files, and there will be a variety of connections between these files, such as function calls. The thing that the linker does is to link these target files with some of the libraries used to form a complete executable file.
If you want to examine in detail what the linker has done, see: http://www.dutor.net/index.php/2012/02/what-linkers-do/
Then, the value set by other linker flags is actually the parameter that is added later when the LD command executes.
The following 3 common parameters are described individually:
-OBJC: When this parameter is added, the linker will load all the Objective-c classes and categories in the static library into the final executable file
-all_load: will let the linker load all the found target files into the executable file, but do not use this parameter arbitrarily! If you use more than one static library file, and then use this parameter, then you are likely to encounter ld:duplicate symbol error, because different library files may have the same target file, so it is recommended to use when encountering-OBJC failure-force_ The load parameter.
-force_load: What you do is exactly the same as-all_load, but-force_load needs to specify the path to the library file to be loaded completely, so you simply load a library file without affecting the rest of the library file's on-demand loading