Build fat static library (device + simulator) using Xcode and SDK 4+

前端 未结 10 1112
独厮守ぢ
独厮守ぢ 2020-11-22 02:21

It appears that we can - theoretically - build a single static library that includes both simulator and iPhone and iPad.

However, Apple has no documentation on this

10条回答
  •  梦如初夏
    2020-11-22 03:04

    I needed a fat static lib for JsonKit so created a static lib project in Xcode and then ran this bash script in the project directory. So long as you've configured the xcode project with "Build active configuration only" turned off, you should get all architectures in one lib.

    #!/bin/bash
    xcodebuild -sdk iphoneos
    xcodebuild -sdk iphonesimulator
    lipo -create -output libJsonKit.a build/Release-iphoneos/libJsonKit.a build/Release-iphonesimulator/libJsonKit.a
    

提交回复
热议问题