I. Framework Encapsulation
1. New Ios->framework & Library->cocoa Touch Framework
2. At project->deployment target->ios Deployment Target Select the minimum system you need to support.
The same operation in targets, Deployment info->deployment Target
3, the dynamic library can be released separately, in the runtime to find and deposit memory, but Apple only allow him to use, until iOS8 open to developers. Therefore, I need to replace the dynamic framework with static mode for the static library. Set path to build Settings->linking->mach-o type->static Library
4. There is still a problem with the packaged framework, and if you use category, someone else will crash when using your framework. At this time others in the reference need in the project other linker flags add-OBJC If there is still a problem, then add-all_load.
5, finally compiled successfully, but found a lot about the symbol table warning, at this time need to set generate Debug symbols to No can turn off the symbol table warning.
< Span style= "font-family: ' Lucida Grande ', ' lucida Sans Unicode ', lucida,helvetica, ' Hiragino sans GB ', ' Microsoft yahei ', ' Wenquanyi Micro Hei ', Sans-serif ">6, but I need to support Bitcode, the above settings do not allow the framework to support Bitcode, so you also need to make additional settings for a command to support bit code. In the Tagets build setting, search for other C Flags, adding the command "-fembed-bitcode". The same settings are in project. If you do not perform the above operation. Others can compile when they integrate your framework, or test them with a real machine. Only a warning is issued and the package fails when packaged. Warning for the framework does not support bitcode!
7. Both the SDK and the framework need to expose common header files for the user to read and. There are three categories of Targets->build phases->headers. Public, where the header is available for other people to view. Private (private) here to store a proprietary header, the above two headers storage location will be exposed, everyone can view. Some of the headers do not want to be seen by others. This header is placed in a third class project.
8, packaging. Edit scheme->build configuration-> is selected as release and run.
two. A packageMake. A
1. Select "Cocoa Touch Static Library", New project
2. Select the. h file that needs to be exposed, the. m file is automatically compiled into a. A file, and the header files that need to be exposed are added to public
Select the real device, then command+b compile, the sdk.a file changes from red to black
Select Simulator, still command+b, simulator and real machine environment. A file is separate
Right-click on "Show in Finder" to view the created. a file
The contents of the Debug-iphoneos folder are used on the real machine.
The contents of the Debug-iphonesimulator folder are used on the simulator.
If scheme is release mode, the resulting folder starts with release
If you want a. A file to be used on both the real machine and the simulator, you need to merge
Enter the command in the terminal
Lipo-create debug-iphoneos/true machine path/sdk.a debug-iphonesimulator/Simulator path/sdk.a-output desktop/get through path/sdk.a
The Lipo–info sdk.a can be used to view the type of. A (simulator or real machine)
IOS SDK Package