I’m moving from Jane

Source address of this article:www.jianshu.com/p/1e3dfc9cd…

background

Because the boss let package SDK, read a few days of blogs, water several groups, finally the big bull told how to choose. (If there are any mistakes, please correct them.)

XCode8.1 is used for lz

1. Select a file

a.

Framework dynamic libraries. Use this method if you include any resource files. Development typically does not include two frameworks because of possible conflicts. However, it is possible for multiple applications to use the same memory. (Dynamic library was not available in the past, I think it only opened last year)

b.

Library Static Library. A file. There is usually no conflict. It’s also more common. But the resource files have to go into the bundle.

Whichever you choose, if you use an open third party framework when encapsulating the SDK, you need to declare it in the documentation to prevent developers from importing it repeatedly and causing conflicts.

2. After choosing

Get rid of the.m file, because that’s what you’re going to use for encapsulation.

Then select 5 places to support the lowest version (wherever you want to support it).

Of course, the Project on the far left should also be selected as the lowest version. The method is the same as above.

Next, start putting in the classes or other files you want to use.

3. The bundle files

As I said, if the static library has a resource file to use, you have to put a.bundle file in it.

You can see that there are two bundles, one under Apple Watch and one under Resource. Here we select the bundle under Resource. The name is the same as the SDK name.

After the preparation is completed, the picture is as follows:

4. Write the code

We can see a dot h file and a dot m file.

At this point, just write code in there. H write method declaration,.m write method implementation.

When you’re done, place the header file you want to expose here

5. Generate static libraries

I’m going to use the real machine, I’m going to pick any simulator, and then I’m going to run CMB + B

You can see that the red.a file has turned black after compilation, and show in Finder can find the path

Place the.h files exposed under.a and include in a folder

Oak, take this folder and use it in the project you need to use it in

Here to thank the communication group of a few bosses: one is cold boiled water, her Jane books address: www.jianshu.com/users/ff48a…

And walk big Guy, whose CSDN:

my.csdn.net/u011496891

And Jue, I don’t know his address

PS: the generated version is the real machine version or emulator version, how to create a real machine and emulator can use the version I do not mention, baidu a lot of tutorials. In addition, it is suggested that third-party libraries should not be sealed into the library, which is prone to conflict. If you do not want to be sealed, remember to change the name. As for how to seal in, I have tried a lot of methods, anyway I have not successfully sealed in,, if you successfully sealed in, please tell me ~~~

——— I am the dividing line ————

The 12.26 update

I know how the third party sealed it, if you don’t expose the header file, put #improt in the.m file, and then pack it, okay