Use Reveal.app to debug the entire project UI time, increase the LD directive-OBJC cause multiple static library conflict issues in the project

Source: Internet
Author: User

Today's access to a new UI debugging tool tutorial is as follows:

iOS real-Computer UI debugging tool--reveal

After introducing the addition of the-objc-framework reveal directive, we find that there are multiple static library conflict problems in the project.

First introduce a directive:

The-all_load option, which causes all classes of methods to be loaded, regardless of whether "your program" is used, all, including the system, the method will be loaded. This approach will not only cause your target program to grow in size, but also tend to cause some conflicts that you will often not be able to resolve (often appearing in the various libraries you link to). You can use the-force_load, which you can specify to load all the methods of the library, this is a good solution, but only after Xcode3.2 support

Scene:

Resolving conflicts between Tencentopenapi.framework and ZBARSDK in _base64_encode functions


Later on the network search, delete the other Linker Flag-all_load can solve the problem of static library conflict,

But doing so will invalidate some external static libraries, using the OBJC extension function (catagory) method. such as Baidumapapi

If some libraries are using extension functions (catagory), you can load the library separately

Use:-force_load

-force_load BAIDUMAPAPI/LIBS/RELEASE-IPHONEOS/LIBBAIDUMAPAPI.A

(Baidumapapi is added to the current directory)

Or

-force_load $ (built_products_dir)/libxxx.a

(This is the direct addition of static library project source code practice)

It is very convenient to use-force_load to load separately, if some functions add the main function to use All_load is quite troublesome.

The above can solve the conflict between Tencentopenapi.framework and ZBARSDK.

If the structure of the two static library conflicts is the same, consider splitting up the two static libraries for merging.

See what the schema of the file is
$ lipo-info LIBZBAR.A
Architectures in the Fat File:libzbar.a are:armv7 (Cputype () Cpusubtype (one)) i386

Unzip the armv7 out Lipo Libzbar.a-thin armv7-output libzbar-armv7.a Create a new folder to store the extracted (. O) files
$ mkdir ARMV7
$ CD ARMv7 to extract the files from the static library $ ar-x. /libzbar-armv7.a


Then the other static library based on the above steps to do it again, and then observe the decompression of the static library, there are those that are the same merge together, but note that the two static library conflict (. o) file must be consistent, otherwise there will be an error.

Packaged after the merger
$ libtool-static-o.. /LIBNEW-ARMV7.A *.O


If you are using the same steps as in a virtual machine, merge the i386 schema together again. Merging static libraries
$ lipo-create-output LIB.A libnew-armv76.a libi386.a

Use Reveal.app to debug the entire project UI time, increase the LD directive-OBJC cause multiple static library conflict issues in the project

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.