Making the iOS Static library

Source: Internet
Author: User

No more nonsense, just on the back of the operating principle.

In peacetime development, several companies may cooperate in a project, but do not want to let another company see their source code, how to do. At this point we can make our own static library.

How to make. A

New project: Select cocoa Touch Static Library

Add the source code you need to make a static library to the project

Select the. h file you want to expose.

Click on the "+"->new headers on the left of build phases. Drag the. h file you want to open into public

Editing the edit scheme, choosing whether to release or debug

Then select the real machine or simulator

Command + B Compilation

Libprojectname.a Right-click Show in Finder appears after compiling

You'll see in the table of contents

I've compiled all four of them once. There are simulators and real machines.

$ lipo-info Libfdhandwrite.a

Architectures in the Fat File:libfdhandwrite.a are:armv7 arm64

In the terminal you can see ARMV7 arm64 that this is a real machine compiled.

$ lipo-info Libfdhandwrite.a

Architectures in the Fat File:libfdhandwrite.a are:i386 x86_64

You can see that the real machine and the simulator are obviously different.

To be able to use both the real machine and the simulator, merge the two. a Files

$ lipo-create release-iphoneos/libfdhandwrite.a release-iphonesimulator/libfdhandwrite.a-output LibHandWrite_ Common.a

The merged. A file can be easily used in other projects. Remember to drag it in together with some. h files.

Complementary principle:

Note: If a schema error i386 or x86_64 is found after compiling

A similar workaround is as follows:

Remember, merge.

Making the iOS Static library

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.