IOS development-function-static library and ios development function static

Source: Internet
Author: User

IOS development-function-static library and ios development function static

1. overview: apple's development mainly provides two types of libraries: static libraries and built-in libraries. framework and self-created. file a is mainly called during compilation, and a dynamic library is mainly used. the end of dylib (or directly. o file), which is created at runtime. the o file is linked to the project file for calling. Apple currently only provides static library encapsulation. Next we will introduce the encapsulation of. a static library.

2. Functions: Mainly used for two purposes: 1). modular functions for reuse; 2) internal implementation of confidential source files to protect the privacy of source files.

3. step: Create a new project file-> select cocoa touch static library-> Create for others to call. h and. m file->. h and. file. the interface functions provided in the H file must be exposed to function interfaces that need to be called by others. in the H file-> because the framework is a static library, it is finally compiled and generated. file a-> locate the file location in products-> Add it to the project to be referenced. file a and the corresponding. h header file (note link binary with library link ). Note: in fact, the. a file is a set of. m files. The. m file is called Based on the packaged. h file.

4. Example: 1.2.3.456

7.8.9.10

5. Problem: 1). Pay attention to the release and debug Versions in Product-> scheme.

2) If the. a file is red after compilation, it indicates that it is not successful. You can switch to the directory of the simulator and device project to generate the black. a file.

3 ). note: Because the simulator is on mac, the cpu architecture is x86 and the arm architecture of devices such as the iPhone is different, we can view the generated file lipo-info xxx. a. if you want to use it at the same time, use lipo-create... /simulator/xxx. a... /device/xxx. a-output... /output location/xxx. a.

Related Article

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.