Making a static library in iOS-create a static library using the creation of a static library project

Source: Internet
Author: User

Recently the company asked to write the SDK, I want to make it into a static library way

My understanding: The so-called Static library, is to pack all the. m files into a. A file, so that the time to share the code is more concise, it is important that no one else will see you. m file of Stupid B code

Environment is Xcode6.2 iOS8.2

First, create a static library project

Delete the file with the same name that Xcode created automatically, and then import the file you need to make a static library

Here I import a simple output string of files

And then choose to run the device to compile, here I have no understanding of the place: in Xcode6.2, when I first select the emulator, and then compile the file,. A file is still red, indicating that the static library is not generated, but when I change the running device to iOS device, the. a file becomes black. , why is this?

Compile results

Right-click on the. a file and select Show in Folder

You can see the. a file in the folder

This is the use of the real machine debugging need to import the static library, this time the magic thing came again, in the Debug-iphoneos folder below a Debug-iphonesimulator folder, opened, there is also a static library file

The. A file here is used when debugging with the simulator.

This even a. A file is used for different debugging devices, and Xcode will error when you use the wrong

debugging, two static library switch will be very cumbersome, and for others to use is not convenient, here can be two. A files packaged into a. a file

Packing method:

This is to intercept someone else's blog, my own path too long, blog address, http://www.cnblogs.com/qingjoin/archive/2013/01/31/2886985.html

In summary, the generated. A file is applicable for both the simulator and the real machine

Then there is a way to view. A files that support the emulator or the real machine:

In the terminal input

Here x86_64 refers to the static library support emulator, if it is ARM7 or ARM8, then the static library is to support the real-machine debugging

We use terminals to synthesize the. A will show up at the same time X86_64,ARM7 and ARM8

The above is said in the Xcode6.2 environment, the generated debugging with static library, because the static library is located in the folder is the beginning of the debug, I saw the tutorial at the beginning of the release, this should be used to publish the application of the static library, which I am not very clear about their differences

Making a static library in iOS-create a static library using the creation of a static library project

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.