Custom .famework production detailed process

1. To create a new project, select iOS —> Cocoa Touch Frame

work

2. Enter the project to delete the header file with the same name of the project

3. Import the files you need

4.4.TARGETS —> Set related items in Build Settings
(1). Build Active Architecture Only set to NO means that the currently packaged .framework supports all devices. Otherwise, it can only be run with the current version of the simulator or real machine when packaging .

2).Build Setting search for linking and set Dead Code Stripping to NO is a compilation option optimization, package slimming, (not changed) Mach-O Type select StaticLibrary (static library) Xcode is a dynamic library by default.

3). Set the minimum supported version of the framework

 5.TARGETS —> Build Phases
drag the header files that need to be presented to the Public directly from Project. H files that do not want to be presented are not recommended to be dragged to Private. Just put them in the project.

6. It should be set to release mode before compiling

7. When you come to the project directory tree, the files under Products are all red. Now we select the .framework file and run it on the real machine and the simulator respectively (successfully run
and then Show in Finder to find the corresponding .framework file (you can see the superior directory (Is the real machine or the simulator folder) The files for the
real machine and the emulator running successfully are in these two folders

Internally, it is divided into Debug version and Release version. At the same time, the two are divided into real machine version and simulator version framework (iphoneos suffix stands for real machine version, iphonesimulator suffix stands for simulator)

8. The real machine version and the simulator version framework are merged
(1). View the architecture information
Open the terminal and use the command line lipo -info to view the framework information of the
real machine version

Emulator version

(2). Merge the real device simulator version
because the framework obtained above can only be run on the corresponding version (that is, the real device can only be run on the device and the simulator version can only be run on the simulator), so it needs to be merged into general Version
Command line statement: sudo lipo -create (please fill in the real machine SSmarqueeView file path here) (here fill in the simulator SSmarqueeView file path) -output custom synthesis file storage path (synthesis file name SSmarqueeView)

9. Integrated use of
the created framework Drag the created framework into the project, reference the relevant header files, and then initialize the exposure method call

Solve the problem of error reporting during merge:

Because both the real machine version and the emulator version contain arm64, you need to set it before merging, as shown below:

 

 

 

 

 

Guess you like

Origin blog.csdn.net/sss1507089/article/details/111982487