静态库动态库编译打包上传问题

最近打提审包遇到两个以前没遇到的问题记录下,后面遇到了少走弯路

  1. error: exportArchive: IPA processing failed

内测企业版签名蓝盾打包没问题,打提审App Store包一直报错:错误提示如下:

2020-12-02 18:17:56.851 xcodebuild[98846:13963971] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/4z/w596prq96zj0l3v5zkxs1mm80000gn/T/xxx_2020-12-02_18-17-56.851.xcdistributionlogs'.
error: exportArchive: IPA processing failed

Error Domain=IDEFoundationErrorDomain Code=1 "IPA processing failed" UserInfo={NSLocalizedDescription=IPA processing failed}

** EXPORT FAILED **

开始以为蓝盾出问题了,因为上午刚打了一个内测企业签名包还没报错。为了验证猜测,本地尝试脚本编译adhoc的包,发现报同样的错,那肯定是工程那里有问题了。Google 找了下类似问题,stackoverflow确实很多人遇到类似的问题,不过按照回答排查了下并没有解决问题。由于距离上个提审包有一段时间了,中间提交的Commit很多,于是和同事分工,我排查最近添加修改的第三方库是不是有问题,同事Checkout到某个Commit然后打包adhoc看是否有同样的问题。我把新添加的库都放入Master分支check出的一个测试分支,打包adhoc后,发现没有问题,难道不是新增库的问题?这时同事把排查范围缩减到一个区间,某个Commit打包成功往后一段Commit打包报错,然后全力检查是那个Commit开始导致的错误。Check后发现某个Commit引入了一个新的Framework后就出现了问题,粗看没啥问题啊,细看发现有Embed,难道这个Framework不是动态库是静态库,用file命令查看了下,确实是静态库Embed后出了这个问题。

顺便提下如何查看静态库还是动态库 file XXX.framework/XXX

  • 静态库: current ar archive
MnaCommon.framework/MnaCommon: Mach-O universal binary with 4 architectures: [i386:current ar archive] [arm_v7] [x86_64] [arm64]
MnaCommon.framework/MnaCommon (for architecture i386):  current ar archive
MnaCommon.framework/MnaCommon (for architecture armv7): current ar archive
MnaCommon.framework/MnaCommon (for architecture x86_64):    current ar archive
MnaCommon.framework/MnaCommon (for architecture arm64): current ar archive
  • 动态库: Mach-O 64-bit dynamically linked shared library
MnaPlayer: Mach-O 64-bit dynamically linked shared library x86_64
  1. ERROR ITMS-90205: "Invalid Bundle. ERROR ITMS-90685: "CFBundleIdentifier Collision.

打包后上传报错:

Package Summary:  1 package(s) were not uploaded because they had problems:     /20201203173205-ipa-com.tencent.xxx-9764/1441393867.itmsp - Error Messages:         ERROR ITMS-90685: "CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.tencent.xxx' under the iOS application 'xxx.app'."        ERROR ITMS-90205: "Invalid Bundle. The bundle at 'xxx.app/PlugIns/PacketTunnel.appex' contains disallowed nested bundles."      ERROR ITMS-90206: "Invalid Bundle. The bundle at 'xxx.app/PlugIns/PacketTunnel.appex' contains disallowed file 'Frameworks'." [2020-12-03 17:34:18 CST] 
 DBG-X: Returning 1

这个问题是出现在上传时报错,由于已经告知了出错的BundleIdentifier所以查找起来比较快,直接说原因了。因为某个动态库,被Embed了两次。一次在Extension进程一次在主进程。解决办法:只需把Extension进程的Embed去掉即可。

总结

在使用第三方或者团队成员打的Framework时首先需要检查好库的类型,然后再集成进工程中,避免静态库Embed,动态库多次Embed操作。

你可能感兴趣的:(静态库动态库编译打包上传问题)