IOS library --. a and. framework

Source: Internet
Author: User

IOS library --. a and. framework

1. What is a database?

Library is a way to share program code, generally divided into static library and dynamic library.

Ii. What is the difference between a static library and a dynamic library?

Static Library: when the link is completely copied to the executable file, multiple redundant copies are generated when it is used for multiple times.

Dynamic library: do not copy links. When the program is running, the system dynamically loads the resources to the memory for the program to call. The system only loads the resources once. Multiple programs are shared to save memory.

Iii. Static library form in iOS?

. A and. framework

4. What is the dynamic library form in iOS?

. Dylib and. framework

5. Why is framework both a static library and a dynamic library?

The. framework of the system is a dynamic library, and the. framework we create ourselves is a static library.

6. What is the difference between a and. framework?

. A is a pure binary file. In the. framework, there are resource files in addition to binary files.

The. a file cannot be used directly. At least. H files must be used together. The. framework file can be used directly.

. A +. h + sourceFile =. framework.

We recommend that you use. framework.

7. Why should I use static databases?

Easy to share code and make it easy to use.

Implement modularization of iOS programs. You can modularize fixed services into static databases.

Share your code library with others, but do not want others to see the implementation of your code.

Third-party sdk development needs.

8. Notes when creating a static database:

1. Note: whether it is. a static library also. framework static library, we need binary files +. h + the format of other resource files. The difference is that ,. a itself is a binary file, and we need to configure it ourselves. h and other files can be used, while. the framework itself contains. h and other files, which can be used directly.

2. Processing of image resources: two static libraries generally place image files separately. in the bundle file. bundle name and. a or. the framework name is the same .. The bundle file is easy to understand. You can create a new folder and change it to. bundle. Right-click the file to add image resources to the package.

3. category is often used in our actual development projects. It is no problem to compress category into a static library, but in the project where this static library is used, when the method in category is called, the running error (selector not recognized) of this method cannot be found. The solution is as follows: configure the value of other linker flags in the project using the static library as-ObjC.

4. If a static library is complex, you need to expose it. h. h file (generally this. the H file name is the same as the static library name), and then all the files to be exposed. H files are concentrated in this. in the H file, and those that need to be exposed. h does not need to be exposed any more. h can be exposed.

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.