iOS 8: "Go" package iOS static library considerations

Source: Internet
Author: User

Source Address: http://fann.im/blog/2014/01/12/ios-static-library/

Something to be aware of in an IOS static library:

  1. namespace conflict. The static library uses a third-party library, and the project uses the same third-party library, and there are errors when compiling, duplicate symbol because there are two identical third-party libraries. The solution is to add a custom prefix to the third-party library used, including the class name, the delegate protocol, the constant name, and, in particular, the method name of the category to be modified.

  2. When you encapsulate a static library, you should try to avoid introducing heavyweight third-party libraries and encapsulating them yourself.

  3. A static library must have its own unique prefix, and all class names, constants, and so on, must be prefixed with the same prefix.

  4. Real machine + simulator support. Xcode only generates a static library with the current environment (real machine or simulator), which is not convenient for debugging other project development. The solution is to generate a generic library from a script, Build_universal_library.sh,via so.

  5. Document. The convenience of the static library is the user directly to use the method you provide, do not pay attention to the specific implementation, inconvenient to see the implementation, problems can not be detected, it is necessary to the SDK version, update history, use, FAQs and other written documents, easy to use, also appears to be the SDK more formal specifications.

  6. A resource file such as a picture is packaged in bundle form. A simple way to make bundles: Create a new folder, rename YourSDK.bundle it, then Show Package Contents open it, and add a picture. You need to specify the bundle when using the picture: [UIImage imageNamed:@"YourSDK.bundle/img.png"] . You can also create bundles using Target, such as the IOS Library with Resources.

  7. Modifying the SDK product path is primarily convenient for packaging, see build_universal_library.sh.

  8. SDK header files Plus version numbers and simple usage notes, developers don't like lengthy document:D.

  9. If the SDK is useful to the Category, note that the project Settings Other Linker Flags -ObjC are added, QA1490.

  10. The SDK can be added to the Sdkdemo project in the form of sub-projects, so that it can be tested while developing. Sdkdemo modified User Header Search Paths to ${SYMROOT}/${CONFIGURATION}-universal/YourSDK , the path and the build_universal_library.sh remain consistent.

iOS 8: "Go" package iOS static library considerations

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.