【问题标题】:How to fix React Native App not building for iOS如何修复不为 iOS 构建的 React Native App
【发布时间】:2020-11-14 20:47:36
【问题描述】:

我在为 iOS 构建我的 react 原生应用时遇到了问题。对于 android,它构建得非常好。对于 iOS,项目将构建但不会存档。这是尝试归档我的项目时的错误代码:

1) Target 'React-Core.common-AccessibilityResources' has create directory command with output '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-gaqwcsmtamkdjtbdiwhnzcvmexjk/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'
2) Target 'React-Core.common-CoreModulesHeaders-AccessibilityResources' has create directory command with output '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-gaqwcsmtamkdjtbdiwhnzcvmexjk/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/AccessibilityResources.bundle'

有几件事要说明: 运行 React-native 0.63, Podfile 和部署目标都在 11 上

编辑:从命令行运行时收到此错误

      '/Users/jacobcarpenter/Library/Developer/Xcode/DerivedData/LFGOPocker-bzowsupbiktzuzaaadvokqxbgvzq/Build/Intermediates.noindex/ArchiveIntermediates/LFGOPocker/BuildProductsPath/Release-iphoneos/YogaKit/YogaKit.modulemap'
      not found```

【问题讨论】:

  • 尝试以下两个选项。 01) 使用传统模式构建应用程序(文件 > 工作区设置 > 构建系统 > 传统构建系统)。 02) 删除所有 pod,重新安装 pod
  • 我在以下链接中的回答可能对某些人有所帮助 - stackoverflow.com/a/68786521/6512858

标签: ios reactjs react-native


【解决方案1】:

我通过从我的 pod 目标中删除“React-Core.common-AccessibilityResources”来修复此错误。尝试存档时,请确保您没有使用 .xcodeproj 并使用您的工作区。即使您认为您正在使用工作区三重检查。此外,如果您尝试通过命令行存档,则必须明确说明工作区。

【讨论】:

  • 您好!你能告诉我如何从我的 pod 目标中删除文件吗?我不太习惯 xCode。
  • 对不起,我刚看到这个,不知道你是否还有这个问题。我所做的是在Xcode的文件目录中点击“Pods”,“Targets”下会有一个列表,找到你要找的pod。
【解决方案2】:

编辑:我通过使用我的 Podfile 从目标中删除仅 React-Core.common-AccessibilityResources 来修复构建问题。

(我想回复 Jake 的回答,但我还没有足够的声誉来发表评论)

我尝试修改我的 Podfile 以从 Pods 项目中排除这两个目标(React-Core.common-AccessibilityResources 和 React-Core.common-CoreModulesHeaders-AccessibilityResources)。它开始编译,但最终还是失败了,说AccessibilityResources.bundle 不存在。

虽然切换到 Legacy Build 系统(在工作区设置中)似乎可以解决 AccessibilityResources 问题,但也会出现其他问题(主要是关于 Swift 库,即使桥已启用)...

我也尝试删除我的 Pods 文件夹并进行全新安装,但不幸的是,这不起作用。

【讨论】:

  • 您好!你能告诉我怎么做吗?我对 xCode 不是很有经验,不想通过删除其他东西来搞乱我的项目。
【解决方案3】:

对于对Pods 不太熟悉的任何人,请将以下几行添加到您的Podfile (RN 0.63.2):

target 'yourapp' do

  # your pods go here

  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])


  # Enables Flipper.
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.

  use_flipper!
  post_install do |installer|
    flipper_post_install(installer)

    ################### ADD THE FOLLOWING #########################
    installer.pods_project.targets.each do |target|
      if target.name == "React-Core.common-AccessibilityResources"
        target.remove_from_project
      end
    end
    ###############################################################

  end
end

【讨论】:

    猜你喜欢
    • 2015-06-05
    • 2016-06-03
    • 1970-01-01
    • 1970-01-01
    • 2021-03-28
    • 2017-03-28
    • 1970-01-01
    • 2018-08-25
    • 2019-03-02
    相关资源
    最近更新 更多