ios 未找到“RCTBundleURLProvider.h”文件 - AppDelegate.m

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/40368211/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 10:41:39  来源:igfitidea点击:

"RCTBundleURLProvider.h" file not found - AppDelegate.m

iosxcodereact-native

提问by FilosoferKing

I am trying to run my React Native app in XCode and I keep getting this error. I cannot figure out how to resolve the issue. Any suggestions?

我正在尝试在 XCode 中运行我的 React Native 应用程序,但我不断收到此错误。我不知道如何解决这个问题。有什么建议?

Screen Shot of Error in XCode:

XCode 中错误的屏幕截图:

screenshot

截屏

采纳答案by Armands Malejevs

Delete node modules, then run npm install(or better yet yarn) and after everything has finished downloading, run react-native upgradewhich should give you the option to replace old files with the template ones, by doing so you re-link your native dependencies in react-native which should fix your problem. Of course don't forget to clean your project in Xcode.

删除节点模块,然后运行npm install(或更好的纱线),并在所有内容下载完成后,运行react-native upgrade它应该可以让您选择用模板文件替换旧文件,通过这样做,您可以在 react-native 中重新链接您的本机依赖项应该可以解决您的问题。当然不要忘记在 Xcode 中清理你的项目。

回答by mark

xcode Product->Scheme->Manage Schemes click '+' at the Target to select "React" and set the React is shared.

xcode Product->Scheme->Manage Schemes 在 Target 处单击“+”以选择“React”并设置 React 是共享的。

回答by Hariks

For all those are using React Native 0.40.0or higher, Header Imports have a major change from RN 0.40.0and result in lots of .h file not found errors. react-native-git-upgradefixed the issue for me while in debug but build fails in release/archive.

对于所有使用React Native 0.40.0或更高版本的用户,Header Imports 与RN 0.40.0 相比有重大变化,并导致大量 .h 文件未找到错误。react-native-git-upgrade在调试时为我解决了这个问题,但在发布/存档时构建失败。

I am using RN 0.42.3with cocoapods and Xcode 8.2.1

我将RN 0.42.3与 cocoapods 和Xcode 8.2.1 一起使用

To completely fix this go to Xcode>Product>Scheme>Edit Scheme>

要完全解决此问题,请转到 Xcode>Product>Scheme>Edit Scheme>

  1. Untick Parallelize Buildenter image description here
  2. Click on + button in Targets and add Reactenter image description here
  3. Drag the added Reactto top of the List in Targets. enter image description here
  1. 取消并行化构建在此处输入图片说明
  2. 单击 Targets 中的 + 按钮并添加React在此处输入图片说明
  3. 将添加的React 拖到Targets 中的列表顶部。 在此处输入图片说明

Now clean the project and build

现在清理项目并构建

回答by Erich

None of the other suggestions were fixing my error but this one did it.

其他建议都没有解决我的错误,但这个建议做到了。

1 - Create Podfile

1 - 创建 Podfile

Create a file named ios/Podfileinside your react-native app with the following contents:

ios/Podfile使用以下内容在您的 react-native 应用程序中创建一个名为的文件:

# You Podfile should look similar to this file. React Native currently does not support use_frameworks!
source 'https://github.com/CocoaPods/Specs.git'

platform :ios, '8.0'

target '<YOUR_APP_NAME>' do
  # Fixes required for pod specs to work with rn 0.42
  react_native_path = "../node_modules/react-native"
  pod "Yoga", :path => "#{react_native_path}/ReactCommon/yoga"
  pod "React", :path => react_native_path, :subspecs => [
    'Core',
    'RCTActionSheet',
    'RCTAnimation',
    'RCTGeolocation',
    'RCTImage',
    'RCTLinkingIOS',
    'RCTNetwork',
    'RCTSettings',
    'RCTText',
    'RCTVibration',
    'RCTWebSocket'
  ]

  pod 'GoogleMaps'  # <~~ remove this line if you do not want to support GoogleMaps on iOS

# when not using frameworks  we can do this instead of including the source files in our project (1/4):
#  pod 'react-native-maps', path: '../../'
#  pod 'react-native-google-maps', path: '../../'  # <~~ if you need GoogleMaps support on iOS
end

2 - Install Podfile

2 - 安装 Podfile

Run the command pod installfrom inside the ios folder.

pod install从 ios 文件夹中运行命令。

3 - Reset XCode

3 - 重置 XCode

Restart XCode and the error should be gone.

重新启动 XCode,错误应该消失了。

回答by Dave Cole

I ran into this problem after my first try running a React build in XCode, and all I had to do was actually build and run to make the error go away (after picking a team and proper provisioning). Sometimes XCode shows errors that aren't really errors until it compiles and links things the first time.

在我第一次尝试在 XCode 中运行 React 构建后,我遇到了这个问题,我所要做的就是实际构建并运行以消除错误(在选择团队并正确配置之后)。有时 XCode 显示的错误在它第一次编译和链接之前并不是真正的错误。

回答by onmyway133

The solution that works for me is to share Reactscheme.

对我有用的解决方案是共享React方案。

If you don't have React scheme, create new one by Selecting scheme menu -> Manage Scheme -> + -> choose React, then mark React scheme as Shared

如果你没有 React 方案,创建一个新的 by Selecting scheme menu -> Manage Scheme -> + -> choose React,然后将 React 方案标记为 Shared

enter image description here

在此处输入图片说明

enter image description hereenter image description here

在此处输入图片说明在此处输入图片说明

Also, if you use Xcode 10, go to File -> Project Settingsand select Legacy build system

此外,如果您使用 Xcode 10,请转到File -> Project Settings并选择 Legacy build system

enter image description here

在此处输入图片说明

回答by Robust

I solved this problem by following steps:

我通过以下步骤解决了这个问题:

  1. In xcode choose project root.
  2. Drag React.xcodeprojfrom Librariesto the root of the project.
  3. Click on project name (in my case it name SaleKit) in TARGETS
  4. Choose Build Phases
  5. In dropdown of Target Dependenciesadd React
  6. Rebuild or re-run
  1. 在 xcode 中选择项目根目录。
  2. 拖动React.xcodeprojLibraries该项目的根目录。
  3. 单击项目名称(在我的情况下是名称SaleKitTARGETS
  4. 选择 Build Phases
  5. Target Dependencies添加下拉菜单中React
  6. 重建或重新运行

enter image description here

在此处输入图片说明

回答by Echo7

For my case in ReactNative "0.54.2", i solved it with following solution

对于我在 ReactNative "0.54.2" 中的情况,我用以下解决方案解决了它

In Xcode select Product->Scheme->Manage Schemes, untick 'YourProject'-tvOS set it to not Shared

在 Xcode select 中Product->Scheme->Manage Schemes,取消勾选'YourProject'-tvOS 将其设置为不共享

回答by Mega Area

Best Solution :

最佳解决方案:

Open 'Build Settings' for your project in Xcode , search 'Header Search Path'.

在 Xcode 中为您的项目打开“Build Settings”,搜索“Header Search Path”。

Double click next to 'Header Search Path', where other properties have a 'yes' or 'no'

双击“标题搜索路径”旁边的其他属性有“是”或“否”

Now add following to the "Header Search Path" (under Build Settings):

现在将以下内容添加到“标题搜索路径”(在构建设置下):

$(SRCROOT)/../node_modules/react-native/React
$(SRCROOT)/../node_modules/react-native/React/Base

Don`t forget Make both of them recursive.

不要忘记使它们都递归。

回答by Saranjith

You might be running .xcodeprojfile after pod is installed.

.xcodeproj安装 pod 后,您可能正在运行文件。

Close it and open .xcworkspacefile. It worked for me.

关闭它并打开.xcworkspace文件。它对我有用。