【问题标题】:Invalid Bundle, The bundle contains disallowed nested bundles, contains disallowed file 'Frameworks'捆绑包无效,捆绑包包含不允许的嵌套包,包含不允许的文件“框架”
【发布时间】:2015-08-02 10:05:14
【问题描述】:

我添加了一个共享框架来在应用程序和手表扩展程序之间共享代码。后来我删除了共享框架,因为它会导致很多问题。我可以建造 并在 iphone 上运行我的应用程序并观看。但是,当我提交到应用商店时,我看到这两个错误:

ERROR ITMS-90205: "Invalid Bundle. The bundle at 'xxx WatchKit Extension.appex' contains disallowed nested bundles."

ERROR ITMS-90206: "Invalid Bundle. The bundle at 'xxx WatchKit Extension.appex' contains disallowed file 'Frameworks'."

我已经尝试了 stackoverflow 上提到的所有解决方案(thisthisthis)它们都不适合我。如何修复错误?来自苹果的错误消息真的没有给出我应该做什么的线索。

【问题讨论】:

标签: ios cocoapods watchkit


【解决方案1】:

我仍然不完全了解导致问题的原因,但我偶然发现了一个最终为我解决问题的答案。

https://github.com/CocoaPods/CocoaPods/issues/4203

具体来说,mikehouse 在 2015 年 10 月 12 日的帖子是解决问题的方法。

将以下运行脚本添加到所有嵌入的扩展目标。就我而言,我必须将运行脚本作为构建阶段添加到我的 Today 扩展和 Apple Watch 应用扩展中。

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

【讨论】:

  • 我不认为这是解决方案,因为脚本将删除名为 frameworks 的文件夹及其所有内容,如果应用程序依赖于任何已删除的框架,您的应用程序将在运行时崩溃。据我了解,您需要联系该框架的开发人员。他们可以删除或重命名文件夹并重建框架。
  • 关键是在构建阶段结束时运行脚本。
  • 优秀。解决了当您拥有 fw 依赖图而不是树时的问题。拯救了我的一天。
【解决方案2】:

“ITMS-90206”错误已在此帖子中解决:Validation Error: Invalid Bundle. The bundle at ... contains disallowed file 'Frameworks'

需要在 WatchKit 扩展的 Build 选项中将设置从 Yes 更改为 No:

Embedded Content Contains Swift Code: No

【讨论】:

  • 这在 XCode 8 中不再单独工作。您还需要设置“始终嵌入 Swift 标准库:否”
【解决方案3】:

以上对我不起作用。

Embedded Content Contains Swift Code: NO

并没有真正为我做任何事情。

我在使用动态框架时遇到了这个问题。 我的动态框架包含其他动态框架,使其正常 拥有:

Embedded Content Contains Swift Code: YES

而是让其他动态框架将其设置为否。 但我不得不设置

Always Embed Swift Standard Libraries: NO

在构建阶段下。

将此设置为 YES 会生成 frameworks 文件夹,导致上传到 ITC 失败。

【讨论】:

  • 这成功地通过了上传过程(我在完成上传之前遇到了错误)但随后收到了来自 Apple 的电子邮件:我们发现您最近交付的“InstaStickers:转 Instagram”的一个或多个问题照片变成贴纸”。要处理您的交付,必须更正以下问题: 无效的捆绑包 - 您的应用程序引用的一个或多个动态库不存在于 dylib 搜索路径中。更正这些问题后,您可以重新交付更正后的二进制文件。此致,App Store 团队
【解决方案4】:

我有一个使用以下构建设置构建的框架:

Always Embed Swift Standard Libraries: YES

Allow Non-Modular includes in Framework Modules: YES

所以我把两者都改成了NO 并再次构建框架。

Always Embed Swift Standard Libraries: NO

Allow Non-Modular includes in Framework Modules: NO

我在我的项目中添加了新构建的框架,因此它成功上传到了 iTunes Connect。

【讨论】:

    【解决方案5】:

    我有一个今天的扩展,它使用我实现的自定义框架。

    我尝试了所有解决方案,但没有任何效果。

    我只在今天的扩展中需要自定义框架,所以我只在今天的扩展中链接并嵌入了这个框架。

    错误的意思是:

    该包包含不允许的框架

    今天的扩展不应该嵌入任何框架,只能链接到它。

    所以我从今天的扩展中删除了框架并将其添加到父应用程序中。

    请注意:

    父应用程序应该使用这个框架,因为它被添加到它,导入应该完成这项工作。

    【讨论】:

      【解决方案6】:

      在主目标中添加:

      cd "${CODESIGNING_FOLDER_PATH}"
      find ./PlugIns -type d -name Frameworks | xargs rm -rf
      

      问题是在同一个项目的多个目标上添加 SPM 包会重复依赖项。这个扩展的框架可能在主要目标上,所以这应该足够了。否则,在主要目标上使用下面的完整脚本,如果需要,它将通过将框架移动到应用程序来删除框架的重复数据。


      不要将此添加到您的扩展目标中。它尝试删除重复的框架,但没有效果,因为它在框架复制到扩展之前运行:

      # this has no effect if you add it to your extension target
      cd "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/"
      if [[ -d "Frameworks" ]]; then 
          rm -fr Frameworks
      fi
      

      我在一个项目中遇到了这个问题,该项目使用 Rx 作为主要目标、框架和扩展中的 SPM 包。如果您有相同或相似的问题(例如Firebase),您可以在主目标中使用以下脚本修复它:

      if ! [ "${CONFIGURATION}" == "Release" ] ; then
      
          echo "early exit"
          exit 0
      fi
      
      cd "${CODESIGNING_FOLDER_PATH}/Frameworks/"
      
      # copy frameworks to TeamworkProjects.app/Frameworks
      for framework in *; do
          if [ -d "$framework" ]; then
              if [ -d "${framework}/Frameworks" ]; then
                  echo "Moving embedded frameworks from ${framework} to ${PRODUCT_NAME}.app/Frameworks"
                  cp -R "${framework}/Frameworks/" .
                  rm -rf "${framework}/Frameworks"
              fi
          fi
      done
      
      # remove leftover nested frameworks
      for framework in *; do
          if [ -d "$framework" ]; then
              if [ -d "${framework}/Frameworks" ]; then
                  echo "Removing embedded frameworks from ${framework} to ${PRODUCT_NAME}.app/Frameworks"
                  rm -rf "${framework}/Frameworks"
              fi
          fi
      done
      
      # Remove Frameworks from PlugIns
      cd "${CODESIGNING_FOLDER_PATH}"
      find ./PlugIns -type d -name Frameworks | xargs rm -rf
      
      # codesign for Debugging on device
      if [ "${CONFIGURATION}" == "Debug" ] & [ "${SDKROOT}" != *Simulator* ] ; then
      
          echo "Code signing frameworks..."
          find "${CODESIGNING_FOLDER_PATH}/Frameworks" -maxdepth 1 -name '*.framework' -print0 | while read -d $'\0' framework
          do
              # only sign frameworks without a signature
              if ! codesign -v "${framework}"; then
                  codesign --force --sign "${EXPANDED_CODE_SIGN_IDENTITY}" --preserve-metadata=identifier,entitlements --timestamp=none "${framework}"
                  echo "Added missing signature to '${framework}'"
              fi
          done
      fi
      

      大部分脚本来自 forums.swift.org 的用户 pewe:Swift packages in multiple targets results in duplication of library code

      【讨论】:

        【解决方案7】:

        我在子项目和我的主项目中添加了一个 swift 包,它是动态库。上传到TestFlight时,我也遇到了这个问题。

        如图,我把子项目的Embed & Sign改成Do Not Embed,然后这个问题就解决了。

        它为我的主要项目保留Embed & Sign。但在子项目中,我将它们改为Do Not Embed

        【讨论】:

          猜你喜欢
          • 2014-11-10
          • 2015-01-25
          • 2023-03-07
          • 2020-05-20
          • 1970-01-01
          • 2014-12-23
          • 2016-06-15
          • 2015-01-25
          相关资源
          最近更新 更多