【问题标题】:'ReactNativeNavigation/ReactNativeNavigation.h' file not found找不到“ReactNativeNavigation/ReactNativeNavigation.h”文件
【发布时间】:2019-01-06 03:23:32
【问题描述】:

注意:请务必评论我应该提到什么来改进这个问题,而不是大拇指向下,我能够成功地为另一个项目设置带有 expo 的 React Navigation,并且会喜欢在这个项目中启动并运行 RNN。


我正在为我的 React Native 应用程序设置 React Native Navigation,特别是使用 Xcode 的 iOS。

我已按照说明更改了AppDelegate.m 文件:

#import "AppDelegate.h"

#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import <ReactNativeNavigation/ReactNativeNavigation.h>

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  return YES;
}

@end

进行更改后,我收到两个 Xcode 错误:

'ReactNativeNavigation/ReactNativeNavigation.h' file not found
Use of undeclared identifier 'ReactNativeNavigation'

我已确保遵循所有步骤,错误发生在React Native Navigation iOS documentation 的第 3 步中

【问题讨论】:

  • 也不理解反对票,所以我赞成 ;-)

标签: ios react-native react-native-navigation


【解决方案1】:

尝试删除 node_modules 文件夹,然后在您的项目目录中执行全新的 npm install 或 yarn install。在运行 react-native 链接之后。

【讨论】:

  • 没有。我的意思是删除你的 node_modules 文件夹。然后在你的项目目录中运行:yarn install 或 npm install。这将重新安装所有依赖项。然后运行:react-native link 将它们链接到您的 ios 项目:facebook.github.io/react-native/docs/linking-libraries-ios.html
  • 好的,谢谢。我花了一点时间才意识到你说的话。我按照你说的做了,现在错误信息消失了。
  • 太棒了!很高兴为您提供帮助。
【解决方案2】:

这里提到https://wix.github.io/react-native-navigation/docs/installing/你可能会遇到这个问题。

您必须将 react native navigation pod 文件手册 pod 'ReactNativeNavigation', :path =&gt; '../node_modules/react-native-navigation' 添加到您的 Podfile 并运行 cd ios &amp;&amp; pod install

【讨论】:

  • 如果你已经成功运行npx rnn-link,那么你只需要运行cd ios &amp;&amp; pod install
猜你喜欢
  • 2019-07-16
  • 1970-01-01
  • 2021-12-26
  • 1970-01-01
  • 1970-01-01
  • 2014-04-09
相关资源
最近更新 更多