使用autobuild.sh脚本在基于Intel芯片的Mac上自动打包没问题,但是换成M1芯片后,发现会报如下错误:
error: Provisioning profile “iOS Team Provisioning Profile: 3EW3QF484M.MojiDict.NewWidget” doesn’t include the currently selected device “Hugecore’s Mac mini meetingroom” (identifier 49040848-7066-5905-95FF-D27CB39353BB). (in target ‘NewWidgetExtension’ from project ‘MOJiDict’)
error: Provisioning profile “iOS Team Provisioning Profile: 3EW3QF484M.MojiDict” doesn’t include the currently selected device “Hugecore’s Mac mini meetingroom” (identifier 49040848-7066-5905-95FF-D27CB39353BB). (in target ‘MOJiDict’ from project ‘MOJiDict’)
/Users/hugecore/builds/4eF_u954/0/Yemingzhi/mojidict_ios/MOJIDict/MOJiDict.xcodeproj: warning: Building for iOS, but the linked and embedded framework ‘Realm.framework’ was built for iOS + iOS Simulator. (in target ‘MOJiDict’ from project ‘MOJiDict’)
error: Provisioning profile “iOS Team Provisioning Profile: 3EW3QF484M.MojiDict.Action” doesn’t include the currently selected device “Hugecore’s Mac mini meetingroom” (identifier 49040848-7066-5905-95FF-D27CB39353BB). (in target ‘Action’ from project ‘MOJiDict’)
error: Provisioning profile “iOS Team Provisioning Profile: 3EW3QF484M.MojiDict.Widget” doesn’t include the currently selected device “Hugecore’s Mac mini meetingroom” (identifier 49040848-7066-5905-95FF-D27CB39353BB). (in target ‘Widget’ from project ‘MOJiDict’)。
解决方案
在脚本文件中,在xcodebuild的命令后追加相应参数为: -destination 'generic/platform=iOS'
。
添加前:xcodebuild archive -workspace ${WORKSPACE_NAME}.xcworkspace -scheme ${SCHEME_NAME} -configuration ${BUILD_CONFIGURATION} -archivePath ${EXPORT_ARCHIVE_PATH}
添加后:xcodebuild archive -workspace ${WORKSPACE_NAME}.xcworkspace -scheme ${SCHEME_NAME} -configuration ${BUILD_CONFIGURATION} -archivePath ${EXPORT_ARCHIVE_PATH} -destination 'generic/platform=iOS'