Unity iOS打包持续集成若干问题整理(脚本自动化打包ipa)

由于Unity通过命令行导出的包很多设置不能手动修改,所以需要做一系列的操作去修改xcode的配置,命令行修改只作用于命令行,并不影响原Unity导出xcode工程。以下解决方案均在命令行中编译xcode时添加执行

1、Architecture不支持armv7

问题原因:一般导出的xcode工程支持armv7以及arm64,如果代码需要不支持armv7则修改修改buildsettings里的Architecture配置删除armv7,命令行中可以指定支持执行的架构。

 -arch ARCH                          build each target for the architecture ARCH; this will override architectures defined in the project

问题解决:使用-arch ARCH 参数指定执行架构,如:-arch arm64

2、证书错误(1):

error: Signing for "XXXXXXX" requires a development team. Select a development team in the project editor. (in target 'XXXXXXX')

问题原因:unity导出工程默认证书是Automatic自动获取,如果xcode未配置则会提示该错误,如果需要手动配置证书则需要指定。(详细见参考文献2)

问题解决:使用DEVELOPMENT_TEAM 参数指定执行架构,DEVELOPMENT_TEAM具体可以查mobileprovision文件,命令如下:DEVELOPMENT_TEAM=XXXXXXXX

3、证书错误(2):

error: XXXXXX has conflicting provisioning settings. XXXXXX is automatically signed, but provisioning profile XXXXXX has been manually specified. Set the provisioning profile value to "XXXXXX" in the build settings editor, or switch to manual signing in the project editor. (in target 'XXXXXX')

问题原因:同上,原因是unity导出工程默认证书是Automatic自动获取,这里通过命令指定为手动配置即可。

问题解决:命令如下:CODE_SIGN_STYLE=Manual

4、编译错误:

ld: could not reparse object file in bitcode bundle: 'Invalid bitcode version (Producer: '1001.0.46.3.0_0' Reader: '1000.11.45.5_0')', using libLTO version 'LLVM version 10.0.0, (clang-1000.11.45.5)' for architecture arm64
clang: error
: linker command failed with exit code 1 (use -v to see invocation)

问题原因:该问题原因是代码不支持bitcode,把bitcode关闭即可,注意导出时bitcode设置在编译时并不起作用。

问题解决:命令如下:ENABLE_BITCODE=No

参考文献:

1、https://help.apple.com/xcode/mac/current/#/itcaec37c2a6

2、https://issues.jenkins-ci.org/browse/JENKINS-38777

3、https://www.jianshu.com/p/4f4d16326152?nomobile=yes

猜你喜欢

转载自blog.csdn.net/xlyrh/article/details/89494348