[英]Universal binary framework, …/TestTarget have the same architectures (arm64) and can't be in the same fat output file
我嘗試創建二進制通用框架,並執行后續步驟
mkdir build
xcodebuild clean build \
-project Target/TestTarget.xcodeproj \
-scheme TestTarget \
-configuration Release \
-sdk iphonesimulator \
-derivedDataPath derived_data
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
mkdir build/simulator
cp -r derived_data/Build/Products/Release-iphonesimulator/TestTarget.framework build/simulator
xcodebuild clean build \
-project Target/TestTarget.xcodeproj \
-scheme TestTarget \
-configuration Release \
-sdk iphoneos \
-derivedDataPath derived_data
BUILD_LIBRARY_FOR_DISTRIBUTION=YES
mkdir build/devices
cp -r derived_data/Build/Products/Release-iphoneos/TestTarget.framework build/devices
mkdir build/universal
cp -r build/devices/TestTarget.framework build/universal/
lipo -create \
build/simulator/TestTarget.framework/TestTarget \
build/devices/TestTarget.framework/TestTarget \
-output build/universal/TestTarget.framework/TestTarget
cp build/simulator/TestTarget.framework/Modules/TestTarget.swiftmodule/* build/universal/TestTarget.framework/Modules/TestTarget.swiftmodule
但是有ERROR ..../TestTarget 具有相同的架構(arm64)並且不能在同一個胖 output 文件中
正如此處所描述的 Apple 支持
像這樣的腳本——任何試圖使用 lipo 之類的命令來操縱 output 的腳本——仍然會在二進制文件中產生不受支持的配置。
而 go 的方法是將framework
分發為xcframework
。 在這里,您有 Apple 文檔如何做到這一點。
xcodebuild -create-xcframework -framework <path> [-framework <path>...] -output <path>
xcodebuild -create-xcframework -library <path> [-headers <path>] [-library <path> [-headers <path>]...] -output <path>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.