zoukankan      html  css  js  c++  java
  • iOS~静态库开发

    在工作中,我们常常需要制作自己的静态库,封装一些模块,以便共享使用。

    多架构(Multi-Architecture)编译

    iOS app需要在许多不同的CPU架构下运行:

    • arm7: 在最老的支持iOS7的设备上使用

    • arm7s: 在iPhone5和5C上使用

    • arm64: 运行于iPhone5S的64位 ARM 处理器 上

    • i386: 32位模拟器上使用

    • x86_64: 64为模拟器上使用

    静态库有真机和模拟器之分,一般可以生产通用静态库

    http://www.cocoachina.com/ios/20150226/11182.html

    http://www.cocoachina.com/ios/20141126/10322.html

    http://www.cocoachina.com/ios/20150127/11022.html

    http://blog.csdn.net/pjk1129/article/details/7255163

    使用Xcode7.0.1 编译出的静态库

    真机支持armv7 arm64 默认居然不带armv7s

    模拟器支持x86_64

    bogon:~ shenlong$ lipo -info /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphoneos/libstatic_test.a
    Architectures in the fat file: /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphoneos/libstatic_test.a are: armv7 arm64
    bogon:~ shenlong$ lipo -info /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphonesimulator/libstatic_test.a
    input file /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphonesimulator/libstatic_test.a is not a fat file
    Non-fat file: /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphonesimulator/libstatic_test.a is architecture: x86_64

    合并2个静态库

    bogon:~ shenlong$ lipo -info /Users/shenlong/Desktop/libMyStatic.a
    Architectures in the fat file: /Users/shenlong/Desktop/libMyStatic.a are: armv7 x86_64 arm64

    目前只支持 armv7  arm64 x86_64 不支持armv7s(iPhone5 iPhone5C)

    下图在CPU框架中添加支持armv7s

    25.png

    如上图,框架中添加armv7s后

    bogon:~ shenlong$ lipo -info /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphoneos/libstatic_test.a
    Architectures in the fat file: /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphoneos/libstatic_test.a are: armv7 arm64 armv7s

    再次合并

    lipo -create /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphoneos/libstatic_test.a /Users/shenlong/Library/Developer/Xcode/DerivedData/static_test-dsdhaafkwbcsczelhkvovfhbaijl/Build/Products/Debug-iphonesimulator/libstatic_test.a -output /Users/shenlong/Desktop/libMyStatic.a

    查看支持框架

    bogon:~ shenlong$ lipo -info /Users/shenlong/Desktop/libMyStatic.a
    Architectures in the fat file: /Users/shenlong/Desktop/libMyStatic.a are: armv7 armv7s x86_64 arm64

    这样就完全支持armv7 armv7s arm64 所有的CPU框架了。

    就是这样!

  • 相关阅读:
    在CentOS中配置DNS服务器
    CENTOS5.3 64位 VNC远程控制Centos 安装配置
    Windows Server 2003 FTP服务器配置详解 20091210 14:23:36| 分类: 服务器 | 标签: |字号大
    Centos 5.1 sendmail邮件服务器安装及配置
    DNS安装配置全过程
    tomcat多域名设置
    tomcat6 优化初步
    让CentOS自动备份mysql数据库 不指定
    开通企业邮箱之前,请登录您企业网站的域名注册服务商的域名管理平台,进行DNS配置及指向设置,谢谢您的配合
    18.3.2 在不同主机上使用 RMAN 备份建立物理备用数据库
  • 原文地址:https://www.cnblogs.com/kevingod/p/4977151.html
Copyright © 2011-2022 走看看