Resolves the. a file conflict in the project and the project. a file conflict.

Source: Internet
Author: User

Resolves the. a file conflict in the project and the project. a file conflict.

. File a is a static file with multiple. in ios project development, when a third-party library is referenced, problems such as library conflicts and the library contains some disabled APIs may occur from time to time, these libraries are often packaged into static library files (that is. file. In this case, we need to be able to make some necessary adjustments to the Object file. Such as retrieving information and removing conflicting databases.

First, let's take a look at some commands for solving the. a file:

1. Check whether the. a file contains relevant information, such as the unique Identifier disabled by Apple.

Find.-name *. a | xargs grep uniqueIdentifier

View the object file information:

Nm xxx. a | grep ". o:" | sed "s/. (// g" | sed "s/). // g" | uniq

2. Remove conflicting libraries, such as openUDID libraries, between different. a files.

1. View ubuntures

Lipo-info libx.

2. If it is a fat file, process it as non-fat.

Lipo libx. a-thin armv7-output libx-armv7.a

3. decompress the object file

Ar xv libx-armv7.a

4. Package the object file

Ar rcs libx. a *. o

5. Generate a Fat file

Lipo-create Libarmv7.a-output libx.

6. Merge the. a file

Lipo-create Libarmv6.a Libarmv7.a-output Lib.

After knowing some commonly used command lines, we can solve the. a file conflict. The steps are as follows:

View package information: lipo-info libx.

If the prompt "fat file" is displayed, this package supports multiple platforms, such as armv7, armv7s, and i386. We need to unpackage the package one by one. Otherwise, we only need to perform one [1-6] operation.

 

1. Create a temporary folder to store the. o file decompressed by the armv7 platform: mkdir armv7

 

2. Remove the armv7 platform package: lipo libx. a-thin armv7-output armv7/libx-armv7.a

 

3. view the file list in the Library: ar-t armv7/libx-armv7.a

 

4. decompress the object file (that is, the. o suffix file): cd armv7 & ar xv libx-armv7.a

 

5. Locate the conflicting package (JSONKit) and delete rm JSONKit. o.

 

6. Re-package the object file: cd .. & ar rcs libx-armv7.a armv7/*. o, you can use the command in [2] again to confirm whether the file has been removed successfully

 

7. Perform the preceding [1-6] operations on the other platforms (armv7s, i386) one by one.

 

8. Re-merge the. a file into the fat file:

Lipo-create libx-armv7.a libx-armv7s.a libx-i386.a-output libSDK-new.a

 

9. copy to the project to overwrite the source file:

Cp libSDK-new.a/Users/tony/Desktop/XXXProject/Lib/libSDK.

 

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.