Disallowed nested bundles, contains disallowed file 'Frameworks' in XCode

这两天在更新一个iOS项目,因为更新XCode 8,遇到了Debug模式下能跑,但是无法打包的问题。

错误症状

具体错误提示是:

点击Archive后,上传后出现错误提示1

Invalid Bundle. The bundle at ‘XXXX’ contains disallowed nested bundles.

或者iTC成功了,但是收到邮件,得到错误提示2

We have discovered one or more issues with your recent delivery for “江雪”. >To process your delivery, the following issues must be corrected:

参考了多个已有的讨论(见Refer), 最终解决办法如下:

背景

Host APP + Today Extension + 多个Framework用来共享代码,Swift(主要) + OC, Cocoapods

解决方式

  1. 对于Framework,尝试将

Embedded Content Contains Swift Code: YES

调成

Embedded Content Contains Swift Code: NO

  1. 对于appex, 在Target(appex)-> Build Phases中点击+, 选择New Run Script Phase, 填入
cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then
    rm -fr Frameworks
fi
  1. 尝试更新Cocoapods版
  2. 清理项目后重新打包

Refer

  1. https://github.com/CocoaPods/CocoaPods/issues/4203
  2. http://stackoverflow.com/questions/25777958/validation-error-invalid-bundle-the-bundle-at-contains-disallowed-file-fr

一次打包+上传,得到错误提示,前后需要近25分钟,这个错误解决起来真的很花时间。

TO DO: 为什么之前XCode 7成功了?