zoukankan      html  css  js  c++  java
  • 使用lipo合并iPhone模拟器和真机的静态类库

    在XCode开发中分为2种运行环境,一种是模拟器,一种是设备(devices),在这两种环境中静态库(.a文件)是不能混用的,混用的话会造成程序崩溃。

    为了避免这种情况,一种做法是分别编译两种版本的静态库,当使用静态库的应用编译不同版本的时候手工切换静态库的版本,这样做很容易造成混乱,不方便管理。

    下面就介绍一下lipo这个命令,lipo命令可以将两种版本的静态库合并成一个通用的动态库

    lipo: Usage: lipo [input_file] ... [-arch  input_file] ... [-info] [-detailed_info] [-output output_file] [-create] [-arch_blank ] [-thin ] [-remove ] ... [-extract ] ... [-extract_family ] ... [-verify_arch  ...] [-replace  ] ...

    lipo 命令使用示例:

    # Set the target folders and the final framework product.
        INSTALL_DIR=${SYMROOT}/FI.framework
        DEVICE_DIR=${SYMROOT}/Release-iphoneos
        SIMULATOR_DIR=${SYMROOT}/Release-iphonesimulator
    
    # Create and renews the final product folder.
        mkdir -p "${INSTALL_DIR}"
        rm -rf "${INSTALL_DIR}"
        rm -rf "${INSTALL_DIR}/FI"
    
    # Copy the header files to the final product folder.
        ditto "${DEVICE_DIR}/FI.framework/Headers" "${INSTALL_DIR}/Headers"
    
    # Use the Lipo Tool to merge both binary files (i386 + armv6/armv7) into one Universal final product.
        lipo -create "${DEVICE_DIR}/FI.framework/FI" "${SIMULATOR_DIR}/FI.framework/FI" -output "${INSTALL_DIR}/FI"

    如何创建通用的FrameWork请参考下面的文章
    http://db-in.com/blog/2011/05/creating-universal-framework-to-iphone-ios/

  • 相关阅读:
    tcl基本语法
    linux hostid与lmhostid
    linux下uptime命令
    介绍一下 WebApplicationContext?
    Spring 由哪些模块组成?
    怎样开启注解装配?
    解释不同方式的自动装配 ?
    @Qualifier 注解有什么用?
    解释 Spring 框架中 bean 的生命周期?
    如何在 spring 中启动注解装配?
  • 原文地址:https://www.cnblogs.com/weinyzhou/p/4983483.html
Copyright © 2011-2022 走看看