[英]“RCTBundleURLProvider.h” file not found - AppDelegate.m
xcode Product->Scheme->Manage Schemes 在 Target 处单击“+”以选择“React”并设置 React 是共享的。
Delete node modules, then run npm install
(or better yet yarn) and after everything has finished downloading, run react-native upgrade
which 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.删除节点模块,然后运行
npm install
(或更好的 yarn),在所有内容下载完成后,运行react-native upgrade
这应该会给你一个用模板替换旧文件的选项,这样做你重新链接你的本地文件react-native 中的依赖项应该可以解决您的问题。 Of course don't forget to clean your project in Xcode.当然不要忘记在 Xcode 中清理你的项目。
For all those are using React Native 0.40.0 or higher, Header Imports have a major change from RN 0.40.0 and result in lots of .h file not found errors.对于所有使用React Native 0.40.0或更高版本的用户,Header Imports 与RN 0.40.0 相比有重大变化,并导致大量 .h 文件未找到错误。
react-native-git-upgrade
fixed the issue for me while in debug but build fails in release/archive. react-native-git-upgrade
在调试时为我解决了这个问题,但在发布/存档时构建失败。
I am using RN 0.42.3 with 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>
Now clean the project and build现在清理项目并构建
None of the other suggestions were fixing my error but this one did it.其他建议都没有解决我的错误,但这个建议做到了。
Create a file named ios/Podfile
inside your react-native app with the following contents:在您的 react-native 应用程序中创建一个名为
ios/Podfile
的文件,其中包含以下内容:
# 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
Run the command pod install
from inside the ios folder.从 ios 文件夹中运行命令
pod install
。
Restart XCode and the error should be gone.重新启动 XCode,错误应该消失了。
The solution that works for me is to share React
scheme.对我
React
的解决方案是共享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 方案,请通过
Selecting scheme menu -> Manage Scheme -> + -> choose React
创建新Selecting scheme menu -> Manage Scheme -> + -> choose React
,然后将 React 方案标记为 Shared
Also, if you use Xcode 10, go to File -> Project Settings
and select Legacy build system此外,如果您使用 Xcode 10,请转到
File -> Project Settings
并选择 Legacy build system
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).在我第一次尝试在 XCode 中运行 React 构建后,我遇到了这个问题,我所要做的就是实际构建并运行以消除错误(在选择团队并正确配置之后)。 Sometimes XCode shows errors that aren't really errors until it compiles and links things the first time.
有时 XCode 显示的错误在它第一次编译和链接之前并不是真正的错误。
I solved this problem by following steps:我通过以下步骤解决了这个问题:
React.xcodeproj
from Libraries
to the root of the project.React.xcodeproj
从Libraries
React.xcodeproj
项目的根目录。SaleKit
) in TARGETS
TARGETS
项目名称(在我的例子中它命名为SaleKit
)Build Phases
Build Phases
Target Dependencies
add React
Target Dependencies
项的下拉列表中添加React
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 中选择
Product->Scheme->Manage Schemes
,取消Product->Scheme->Manage Schemes
'YourProject'-tvOS 将其设置为不共享
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.不要忘记使它们都递归。
You might be running .xcodeproj
file after pod is installed.安装 pod 后,您可能正在运行
.xcodeproj
文件。
Close it and open .xcworkspace
file.关闭它并打开
.xcworkspace
文件。 It worked for me.它对我有用。
In the base dir of the project I run:在我运行的项目的基本目录中:
node_modules/react-native/packager/packager.sh --reset-cache
Which resulted in:这导致:
Scanning 554 folders for symlinks in /Users/..../work/..../react_tutorial/AwesomeProject/node_modules (15ms)
┌────────────────────────────────────────────────────────────────────────────┐
│ Running packager on port 8081. │
│ │
│ Keep this packager running while developing on any JS projects. Feel │
│ free to close this tab and run your own packager instance if you │
│ prefer. │
│ │
│ https://github.com/facebook/react-native │
│ │
└────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
/Users/..../work/...../react_tutorial/AwesomeProject
Loading dependency graph... ERROR Packager can't listen on port 8081
Most likely another process is already using this port
Run the following command to find out which process:
lsof -i :8081
I found that package manager can't run when another packager process is running.我发现当另一个打包进程正在运行时,包管理器无法运行。
I found the process running with:我发现该进程正在运行:
lsof -i :8081
Than I kill 9 ...
the process.比我
kill 9 ...
的过程。
After than I closed Xcode, run:在我关闭 Xcode 之后,运行:
npm install
And started Xcode again, from this moment everything work as expected!!并再次启动 Xcode,从这一刻起一切都按预期工作!!
Try the following:请尝试以下操作:
I had the same issue and I fixed it by placing RNFIRMessaging.h above the React/RCTBundleURLProvider.h我遇到了同样的问题,我通过将RNFIRMessaging.h放在React/RCTBundleURLProvider.h 之上来解决它
So it look I will look like:所以看起来我看起来像:
#import "AppDelegate.h"
#import "RNFIRMessaging.h"
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
在您的项目目录中运行npm install
以安装react-native
解决此错误。
click Product->Scheme->Manage Schemes->+ .点击产品->方案->管理方案->+。 and then add react as shared.
然后添加反应作为共享。 also insure that your project name is there too.
还要确保您的项目名称也在那里。
I faced same issue .then i have deleted node .try to use these steps我遇到了同样的问题。然后我删除了节点。尝试使用这些步骤
then make build and see然后进行构建并查看
我发现升级 React 后我解决这个问题的方法是将#import "RCTBundleURLProvider.h"
的声明更改为#import <React/RCTBundleURLProvider.h>
For me replacing对我来说更换
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
by由
#import <RCTBundleURLProvider.h>
#import <RCTRootView.h>
in AppDelegate.m file worked.在 AppDelegate.m 文件中工作。
如果你还没有运行npm install
你很可能会遇到这个问题。
我尝试了所有建议,但没有一个在我删除存储库并再次克隆它时对我有用,所以我的建议是提交您的更改备份它们并再次克隆对我有用的存储库。
I have gone through all the answers mentioned above.我已经完成了上面提到的所有答案。
Here is the solution worked for me:这是对我有用的解决方案:
STEP 1:第 1 步:
Run:运行:
npm install react-native-fcm --save
This result in making the directory in your project under node_modules > react-native-fcm这导致在node_modules > react-native-fcm下创建项目中的目录
STEP 2:第 2 步:
You need to add '$(SRCROOT)/../node_modules/react-native-fcm/ios'
to header search paths in build settings.您需要将
'$(SRCROOT)/../node_modules/react-native-fcm/ios'
到构建设置中的标头搜索路径。
These 2 steps worked for me to remove the error.这两个步骤对我有用,可以消除错误。
For more details you can go through these links:有关更多详细信息,您可以访问以下链接:
https://github.com/evollu/react-native-fcm/issues/63 https://github.com/evollu/react-native-fcm/issues/63
https://github.com/evollu/react-native-fcm/issues/21 https://github.com/evollu/react-native-fcm/issues/21
For my case, I couldn't delete node_modules and re-install and I also couldn't do react-native-git-updgrade
or react-native upgrade
because I wanted to stay on RN-0.59 because .60 causes problems for my dependencies.就我而言,我无法删除 node_modules 并重新安装,也无法执行
react-native-git-updgrade
或react-native upgrade
因为我想继续使用 RN-0.59,因为 .60 会导致我的依赖项出现问题.
Anyway my situation was that I was missing 'React/RCTBundleURLProvider.h' file.无论如何,我的情况是我缺少“React/RCTBundleURLProvider.h”文件。 I already had React available in my schemas.
我的模式中已经有 React 可用。 It was not in my libraries directory.
它不在我的库目录中。 I checked my target 's build settings.
我检查了我的target的构建设置。
Inside target dependencies, I also had React in there.在目标依赖项中,我也有 React。
I deleted 'React' target dependency, then re-added.我删除了“React”目标依赖项,然后重新添加。 cleaned build folders, re-built project.
清理构建文件夹,重新构建项目。 it worked.
它起作用了。
I am using React Native 0.61.我正在使用 React Native 0.61。 I created a Share Extension and was getting this error.
我创建了一个共享扩展并收到此错误。 I needed to replace:
我需要更换:
#import "RCTBundleURLProvider.h"
with与
#import "React/RCTBundleURLProvider.h"
https://github.com/facebook/react-native/blob/v0.63.3/template/ios/Podfile https://github.com/facebook/react-native/blob/v0.63.3/template/ios/Podfile
Find/Replace HelloWorld
with your your project name.使用您的项目名称查找/替换
HelloWorld
。
Place this file into the ./ios
folder in your project将此文件放入项目中的
./ios
文件夹中
gem install cocoapods
cd ios
pod install
Then open the YourProject.xcworkspace
file in XCode然后在 XCode 中打开
YourProject.xcworkspace
文件
in XCode, go to Product -> Scheme -> Manage Schemes
and check React
在 XCode 中,转到
Product -> Scheme -> Manage Schemes
并检查React
Then try building the project again.然后再次尝试构建项目。
you need to install react native, in terminal run您需要在终端运行中安装 react native
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
then那么
brew install node
brew install watchman
npm install -g react-native-cli
source:来源:
https://facebook.github.io/react-native/docs/getting-started.html https://facebook.github.io/react-native/docs/getting-started.html
Make sure that the path to your project don't have any spaces.确保您的项目路径没有任何空格。 Just renaming folders and deleting spaces solves the problem for me.
只需重命名文件夹和删除空格就可以解决我的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.