IOS third-party library conflict handling

Source: Internet
Author: User

The recent project team is doing some third-party functionality integration, more than once encountered third-party library conflicts, the error is as follows: Duplicate symbol _objc_metaclass_$_jkserializer in:/users/tony/desktop/ XXXPROJECT/LIB/LIBMIPUSHSDK.A (JSONKIT.O)/users/tony/library/developer/xcode/deriveddata/ XXXPROJECT-BOQKAJMZATZXOHBYRRHKLFIUKNIC/BUILD/PRODUCTS/DEBUG-IPHONEOS/LIBPODS.A (JSONKIT.O) ld:24 Duplicate Symbols for Architecture Armv7clang:error:linker command failed with exit code 1 (use-v to see invocation) in this error, the reason is the third Observes himself packaged the Jsonkit library, and we used the library in our project. This situation requires that we remove the conflicting libraries in the third-party SDK and repackage them after unpacking. The resolution step first finds the library file by following the path mentioned in the above error:/USERS/TONY/DESKTOP/XXXPROJECT/LIB/LIBMIPUSHSDK.A, copy it out for further processing. View package information: Lipo-info libx.a If the FAT file is prompted, then the package is supported on multiple platforms, such as ARMV7,ARMV7S,I386, which requires us to unpack the package one by one. Otherwise we just need to do it once. [1-6] To create a temporary folder for the ARMV7 platform after extracting the. o File: mkdir armv7 Remove the ARMV7 platform package: Lipo Libx.a-thin armv7-output armv7/ LIBX-ARMV7.A View the list of files included in the library: Ar-t armv7/libx-armv7.a Extract the object file (i.e.. o suffix file): cd armv7 && ar XV LIBX-ARMV7.A Find the conflicting package (Jsonkit), remove RM jsonkit.o RePack Object FILE:CD. && ar RCS libx-armv7.a armv7/*.o, you can use the command in [2] againIf the file has been successfully removed, a few other platforms (armv7s, i386) packages are re-merged into the FAT file by doing the [1-6] operation. A file: lipo-create libx-armv7.a libx-armv7s.a libx-i386.a- Output LIBMIPUSHSDK-NEW.A Copy to project overwrite source file: CP libmipushsdk-new.a/users/tony/desktop/xxxproject/lib/ Libmipushsdk.aios Programming: Third-party static libraries (. A files) processing Monday, Sep 16th, 2013 | Posted in Uncategorized | 1 Comment When referencing a third-party library, it occasionally encounters issues such as library conflicts, libraries containing some disabled APIs, and these libraries are often packaged into static library files (i.e.. A files) for use. At this point we need to be able to make some necessary processing adjustments to the object file. such as retrieving information, removing conflicting libraries, and so on. Here are some common methods: first, find out if the. A file contains relevant information, such as the unique Identifier that Apple has disabled. Find. -name *.a |xargs grep uniqueidentifier View object file information: NM XXX.A | grep ". O:" | Sed "s/. (//g "| sed" s/).//g "| Uniq Two, remove the conflicts between the different. A files, such as the Openudid library, that contain conflicting libraries. 1. View Architectureslipo-info libx.a2. If it is a FAT file, it is processed into Non-fatlipo libx.a-thin armv7-output libx-armv7.a3. Extract the Object Filear XV libx-armv7.a4. Package Object Filear RCS libx.a *.o5. Generates a fat filelipo-create libarmv7.a-output libx.a6. Merge. A files lipo-create libarmv6.a libarmv7.a-output LIB.A

Handling IOS third-party library conflicts

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.