iOS production. A static library

Source: Internet
Author: User

Here's a look at the specific build steps:

1, create a new Framework&library library. Cocoa Touch Static library under IOS. Then enter product name as Jsonmodel

2, the JsonMdel.h and jsonmdel.m deleted. Import your own files

3, modify scheme, set to release version.

4. Display useful header files

OK, choose iOS Device compilation run. After success, a LIBJSONMODEL.A file is generated under the build/products/release-iphoneos/of the directory.

Note that this produces the. a file used by the real machine.

The Iphonesimulator is compiled once, and a LIBJSONMODEL.A file is generated under build/products/release-iphonesimulator/.

Here is the. A file used by the virtual machine.

Let's take a look at the differences between these two files and use the Lipo-info command.

Open the terminal.

Go to the appropriate directory.

Real-Machine: LIBJSONMODEL.A file information.

Input file Libjsonmodel.a is not a FAT file

Non-fat FILE:LIBJSONMODEL.A is architecture:armv7

Emulator's: LIBJSONMODEL.A file information.

Input file Libjsonmodel.a is not a FAT file

Non-fat FILE:LIBJSONMODEL.A is architecture:i386

If you use a real machine and a simulator, you need to merge the two files and use the command lipo-create XXXX/LIBJSONMODEL.A xxxxx/libjsonmodel.a-output JSONMODEL.A

You can also use Lipo-info to view the merged JSONMODEL.A

You can see the architectures in the Fat FILE:JSONMODEL.A are:i386 armv7

OK, Package complete. This static library is a lot simpler than the framework.

If you are using category in a static library project, you may encounter a link problem, and the solution is to use the "-all_load" compilation option in both the project that generates the static library and the project that uses the static library, that is, the "build" corresponding to the target Settings "Other Linker Flags" option to add "-all_load". Note: The use of static libraries in the project is sure to add the compilation option!! The project to generate a static library has not been tried, but it is recommended that you add this compilation option.

iOS production. A 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.