关于MOJiThemeKit框架使用Bundle作为资源包时上传APP会报错(ERROR ITMS-90166/90171)的解决方案

由于MOJiThemeKit框架访问的资源包是采用Bundle的方式,而在整个开发过程中并没有不适。偏偏到了上传APP的时候,报了一堆错误,如下(这里举例几个错误提示):

ERROR ITMS-90166: “Missing Code Signing Entitlements. No entitlements found in bundle ‘com.moji.MOJiThemeCustomBackground’ for executable ‘Payload/MOJiDict.app/Frameworks/MOJiThemeKit.framework/MOJiThemeCustomBackground.bundle/MOJiThemeCustomBackground’.””

第一时间Google了“ERROR ITMS-90166”,被告知要把bundle文件夹下的info.plist文件内部的”Executable file”参数移除掉,如图:

需要移除箭头指向的参数和其对应的值

“ERROR ITMS-90166”问题得以解决。

ERROR ITMS-90171: “Invalid Bundle Structure – The binary file ‘MOJiDict.app/Frameworks/MOJiThemeKit.framework/MOJiThemeCustomBackground.bundle/MOJiThemeCustomBackground’ is not permitted. Your app can’t contain standalone executables or libraries, other than a valid CFBundleExecutable of supported bundles. Refer to the Bundle Programming Guide at https://developer.apple.com/go/?id=bundle-structure for information on the iOS app bundle structure.”

“ERROR ITMS-90171”该问题直接Google还看不出具体的解决办法,后面再细看内容说明,他依然强调可执行文件,所以在打包后,直接进入对应的bundle下面找内部文件,发现,其确实存在可执行文件(这里我就不贴图了)。

猜想:直接在build项目的时候把bundle的可执行文件删了不就OK了?

经过Google后,找到解决方案:找到对应的target,然后在Build Settings里面搜索“Versioning System”,如图:

把“Versioning System”的值设置为”None”即可,如图:

MOJiThemeKit里有7个bundle都要设置,重新编译并打包,“ERROR ITMS-90171”问题得以解决。

关于在基于M1芯片的Mac上自动打包报错的问题的处理

使用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'