'ReactNativeNavigation/ReactNativeNavigation.h' 找不到文件

'ReactNativeNavigation/ReactNativeNavigation.h' file not found

注意:请务必评论我应该提到什么来改进这个问题而不是拒绝,我能够成功地为另一个 expo 设置 React Navigation项目,并希望在这个项目中启动 RNN 和 运行。


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

我已经按照说明更改了 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 步

尝试删除 node_modules 文件夹,然后在您的项目目录中执行全新的 npm 安装或纱线安装。接下来 运行 react-native link.

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

你必须添加 react native navigation pod file manual pod 'ReactNativeNavigation', :path => '../node_modules/react-native-navigation' 到你的 Podfile 和 运行 cd ios && pod install