我在制作xcframework的时候,脚本编译真机架构没问题,但是编译模拟器架构报错
** ARCHIVE FAILED **
The following build commands failed:
SwiftEmitModule normal arm64 Emitting\ module\ for\ ZY_SDK (in target 'ZY_SDK' from project 'ZY_SDK')
(1 failure)
或者
** ARCHIVE FAILED **
The following build commands failed:
SwiftEmitModule normal arm64 Emitting\ module\ for\ RXD_SDK (in target 'ZY_SDK' from project 'ZY_SDK')
SwiftEmitModule normal x86_64 Emitting\ module\ for\ RXD_SDK (in target 'ZY_SDK' from project 'ZY_SDK)
(2 failures)
以下是我编译的脚本部分命令
#先将工程编译为 iphoneSimulator架构
xcodebuild archive -workspace ZYFramework/${project_name}.xcworkspace \
-scheme ${scheme_name} \
-configuration ${development_mode} \
-destination 'generic/platform=iOS Simulator' \
-archivePath 'archives/LZBaseKit.framework-iphonesimulator.xcarchive' \
SKIP_INSTALL=NO
#先将工程编译为 编译真机的架构
xcodebuild archive -workspace LZFramework/${project_name}.xcworkspace \
-scheme ${scheme_name} \
-configuration ${development_mode} \
-destination 'generic/platform=iOS' \
-archivePath 'archives/LZBaseKit.framework-iphoneos.xcarchive' \
SKIP_INSTALL=NO
非常奇怪,两边代码差不多,为什么模拟器就是不行,后来我在stackoverflow找到答案。
我们不仅需要 - workspace ProjectName.xcworkspace, 如果我们的 framework 是用了 pods. 还要加
我把模拟器代码改成
xcodebuild archive -workspace ZYFramework/${project_name}.xcworkspace \
-scheme ${scheme_name} \
-sdk iphonesimulator \
-configuration ${development_mode} \
-archivePath 'archives/RXD_SDK.framework-iphonesimulator.xcarchive' \
BUILD_LIBRARY_FOR_DISTRIBUTION=YES \
SKIP_INSTALL=NO
去掉了#-destination 'generic/platform=iOS Simulator'
加上了-sdk iphonesimulator \和BUILD_LIBRARY_FOR_DISTRIBUTION=YES
再次执行脚本命令 ARCHIVE SUCCEEDED
如果还出现此问题,可以检查SDK的Excluded Architectures
我发现原有项目是这样的
改动成以下方式就ok了