IOS own packaged SDK package and merge, beginner Tutorial!!!

Source: Internet
Author: User

Objective
(1) This time will have to say static library, dynamic library differences.
Static Library: 1. Modular, Division of labor. 2. Avoiding minor changes often results in a large number of duplicate compilation links. 3. Can also be reused, note not shared use.
Dynamic libraries: 1. Using dynamic libraries, you can reduce the volume of your final executable file. 2. Using dynamic libraries, multiple applications share the same library files in memory, saving resources. 3. Using a dynamic library, you can update the dynamic library file to update the application without recompiling the connection executable.
Note: Apple disables the dynamic library, that is, you use a dynamic library, audit is not allowed to pass.
(2) Static libraries are divided into: the framework and the Static library (. a).
Here is the difference between the framework and the static library and their pros and cons.
Common denominator: both static libraries
Difference: 1. Content Category:
(1) The framework for a one-stop sharing copy, can also be said to be a folder, which contains code signing, header files, binary execution files, static resource files (xib, pictures) and so on.
(2) The static Library is the. A file, which executes the file for the binary. When sharing to others, header files, static resource files (xib, pictures) need to be provided separately, provided in the way for bundles, below I will describe how to play bundles of bundles.
2. header File Search path difference: staticlibrary need to set the header file search path, the framework does not need.
3. When there is a dependency on external code:
(1) Statcilibrary: can only refer to the external header file, call the public method. Instead of introducing the implementation of its library, implement a separate deployment from the reference library. If your project contains the same class in the library, a code violation occurs.
(2) Framework: You need to reference an external library, you must put the implementation of this external library into the framework to compile. Assume that the project contains the same class in the library, that there will be no conflicts, run independently.

Summary: If you do not consider code conflicts, you can establish staticlibrary, because this can reduce the size of the package.

1. First create the static Library
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503152215892?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
(1). Create the complete, then we put the previously encapsulated code, all imported.
Then we find Complie sources in the build settings, which is a collection of. h and. M. It can also be understood as something that our SDK is not exposed to.
The next one we have is copy files, which is where we leak out of the bag. H.
Note: You can add your own requirements.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503152340645?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
(2). We go to build setting to find the base SDK to choose Latest IOS, because there are many types of, macos,tvos ....
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503152454114?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
Then find linking other Linker Flags by default is-OBJC, but we write the SDK source code may not just-OBJC there may be a classification and so on. To be modified to-all_load, it will crash if not modified.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503152708086?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
(3). Finally we have the same breakpoint as the normal package configuration, release, don't forget.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503152816178?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
2. Then we can pack it up.
When packing, we should pay attention to two kinds of. A, A. A for the simulator, and another for the real machine. A.
Here to illustrate a point, the real machine. A can only be used in real-life, simulator use will be error. The simulator's. A also comes in, if the simulator's. A is used with the real machine will also error. This time we are involved in a merger problem, that is, the real machine and the simulator. a merge. It is then provided to the user.
Using the terminal, the command is as follows.
lipo-create/users/xxx/library/developer/xcode/deriveddata/print-dgfkluumuexoxhcapzidtsmdgqcj/build/products/ Release-iphonesimulator/xxx.a/users/xxx/library/developer/xcode/deriveddata/print-dgfkluumuexoxhcapzidtsmdgqcj /build/products/release-iphoneos/xxx.a-output/users/xxx/desktop/xxx.a

/users/xxx/library/developer/xcode/deriveddata/print-dgfkluumuexoxhcapzidtsmdgqcj/build/products/ Release-iphonesimulator/xxx.a
Simulator Path,
/users/xxx/library/developer/xcode/deriveddata/print-dgfkluumuexoxhcapzidtsmdgqcj/build/products/ Release-iphoneos/xxx.a
The true machine path.
/users/xxx/desktop/xxx.a
The output path after compositing.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503153406868?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
This is done by merging and can be used.

3. Below I introduce the bundle of bundles.
This bundle I have described above is used to store static resource files (xib, pictures).
First we build a bundle
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503154739396?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
and change him to iOS.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503154810709?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
and import the resource file into it.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503154836861?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
Then just pack it up.
Note: You may have questions about why you should use bundles and not just put them in. A. Because the path is not readable when you put the package directly in. A, you must use bundles as a backing. Here's a question of how to call a.
This is the implementation in your project code. You can write a macro, I'm just an example here.
650) this.width=650; "Src=" http://img.blog.csdn.net/20170503154949914?watermark/2/text/ ahr0cdovl2jsb2cuy3nkbi5uzxqvtg92zvnub3cwmjiw/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity/ Southeast "alt=" here to write a picture describing "title=" "/>
So that one of our complete. A is done.
This article is more tedious to write, just want to let the novice, can better understand.


This article from the "12870834" blog, reproduced please contact the author!

IOS own packaged SDK package and merge, beginner Tutorial!!!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.