IOS Package SDK

Source: Internet
Author: User

The main purpose of this tutorial is to explain how to create and use an SDK, commonly known as. a files, in your iOS project.

Environment: Xcode 9.0

Create a static library project

Open Xcode, click File\new\project, select Ios\framework and Library\cocoa Touch Static library to create a new static libraries project.

Name the project Sdktest, and then save the project to an empty directory.

When you create a static library project, Xcode automatically adds. h and. M. You do not need to implement the file, so right-click sdktest.m Select Delete and delete it. Then the project is ready to use, and it's time to add some functionality to your library. As the key to this tutorial is to teach you how to create a sdktest.a, rather than how to build a UI control, here you can use your own encapsulated controls. Drag your control from the Finder to the Sdktest directory in Xcode.

One thing to note here is that the control is dragged into the project. The following three options must be checked:

Copy Items if needed

Create Gruoups

Add to targets

Another thing you need to do for your control's header file is to add it to the library's main header file, SDKTest.h. With the help of this main header file, developers using your library just need to import a header file, as in the following code, rather than choosing the one you need.

Next, create a static library

1, Static library is divided into two types of mobile phone and simulator (mobile phone only can call the phone, simulator only can be called simulator).

First of all, build a static library of the simulator, (Click the Triangle button on it, in fact, it is compiled, the picture I wrote a run)!

Then the show in Finder drags. A files to the desktop, and the real machine. A file can be changed to a name to facilitate the synthesis of a. a file.

After opening the terminal to execute the following command, here will not copy, hand-tap memory, run time the desktop will generate a composite. a file.

And then I got this. A file has all the. h files associated with him, stored in a new folder (randomly named, as follows

Now, you can take this folder to test it. Drag it to the project you want to apply

After that you can refer to the SDKTest.h file to use the control just now, in fact very simple.

Thanks for this

But this is only for those who do not have a reference to the picture and xib, if you want to package the SDK contains xib what to do, this kind of resource files need to be processed separately.

IOS Package SDK

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.