Xcode 存档验证错误 - Xcode 9 和 Swift 4

Xcode Archive Validation Errors - Xcode 9 and Swift 4

当我尝试使用 Xcode 存档将应用上传到应用商店时,出现以下验证错误:

iTunes Store Operation Failed Invalid Bundle. The bundle at 'Dvp.app/Frameworks/AlamofireSwiftyJSON.framework' contains disallowed file 'Frameworks'.

iTunes Store Operation Failed Invalid Bundle. The bundle at 'Dvp.app/Frameworks/AlamofireSwiftyJSON.framework' contains disallowed nested bundles.

iTunes Store Operation Failed CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.swiftyjson.SwiftyJSON' under the iOS application 'Dvp.app'.

iTunes Store Operation Failed CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'org.alamofire.Alamofire' under the iOS application 'Dvp.app'.

我通过将它们拖放到我的项目中来引用这些框架。我没有使用 cocoapod 或 swift 包管理器将第三方框架引用到该项目。

知道如何解决这些验证问题吗?

谢谢

归档应用后,选择 AppStore 生成 ipa,并使用 Application Loader 上传

对我来说解决这个问题的关键是,除了 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO 之外,还在除主应用程序目标之外的所有目标的构建设置中设置 EMBEDDED_CONTENT_CONTAINS_SWIFT=NO。必须清除派生数据,但之后一切正常。

在这种情况下,这些验证错误的发生是因为 AlamofireSwiftyJSON 框架。错误如下:

iTunes Store Operation Failed Invalid Bundle. The bundle at 'Dvp.app/Frameworks/AlamofireSwiftyJSON.framework' contains disallowed file 'Frameworks'.

iTunes Store Operation Failed Invalid Bundle. The bundle at 'Dvp.app/Frameworks/AlamofireSwiftyJSON.framework' contains disallowed nested bundles.

为了消除上述错误,我刚刚选择了 AlamofireSwiftyJSON 目标并在 "Build Phase" 选项卡中添加了一个 "Run Script"。

参考下图:

cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
if [[ -d "Frameworks" ]]; then
rm -fr Frameworks
fi

这修复了上述验证错误以及以下验证错误:

iTunes Store Operation Failed CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'com.swiftyjson.SwiftyJSON' under the iOS application 'Dvp.app'.

iTunes Store Operation Failed CFBundleIdentifier Collision. There is more than one bundle with the CFBundleIdentifier value 'org.alamofire.Alamofire' under the iOS application 'Dvp.app'.

希望这会有所帮助。