Xcode iOS包含不允许的文件'Frameworks'

问题描述 投票:2回答:1

我正在尝试发布iOS swift应用程序。我使用Xcode 9.4.1。该应用程序包含一个共享扩展,用于执行HTTP上载文件。共享扩展使用SwiftHTTP。应用验证失败,并出现以下错误:

Invalid Bundle. The bundle at 'FooBar.app/PlugIns/FileUploadextension.appex' contains disallowed nested bundles.
An unknown error occurred.

Invalid Bundle. The bundle at 'FooBar.app/PlugIns/FileUploadextension.appex' contains disallowed file 'Frameworks'.
An unknown error occurred.

我在StackOverflow上检查了有关错误消息的其他答案。

我禁用了swift库的嵌入扩展:

enter image description here

已为主应用启用嵌入:

enter image description here

扩展有一个框架复制步骤:

enter image description here

我尝试将this script添加到扩展构建阶段:

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

使用此脚本,应用程序将通过验证,但扩展程序不起作用。它失败了:

Hub connection error Error Domain=NSCocoaErrorDomain
Code=4097 "connection to service named
xxx.FooBar.FileUploadextension"
UserInfo={NSDebugDescription=connection to service named

当我在Finder中打开我的FileUpload extension.apex时,我有一个带有SwiftHTTP.framework的Frameworks目录。如何解决问题以通过验证并使扩展工作?

ios swift xcode app-store
1个回答
1
投票

所以我的问题是需要一个库的应用程序扩展(共享扩展)。您的扩展程序无法嵌入库,因此您必须执行的操作是将库嵌入主应用程序,然后从扩展程序链接到该应用程序。

如果您使用的是Carthage,那么我假设您已将Carthage复制脚本添加为运行脚本。

enter image description here

您必须只为主应用程序而不是扩展程序。扩展使用的任何库都必须在输入文件中列出。

然后在您的扩展中,只需将框架添加为链接二进制文件

enter image description here

从您的扩展程序中删除“复制框架”步骤。

© www.soinside.com 2019 - 2024. All rights reserved.