3

我已经为我的 React Native 应用程序集成了 React Native Navigation 包。我需要将旧的 React Native Navigation 版本更新到最新版本。我正在关注它的官方文档进行设置:: 检查此链接https://wix.github.io/react-native-navigation/#/docs/Installing?id=ios

我在 iOS 链接中遇到问题。

错误:: 'ReactNativeNavigation/ReactNativeNavigation.h' 文件未找到

错误:: 语义问题:使用未声明的标识符 ReactNativeNavigation

我也关注了上一篇文章,但它对我不起作用链接 我正在为我的应用程序设置 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:(UIΩApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];
  
  return YES;
}

@end

请建议如何为 iOS 平台解决此问题。

4

2 回答 2

2

我仍然有其他构建问题,但添加了该行

pod 'ReactNativeNavigation', :podspec => '../node_modules/react-native-navigation/ReactNativeNavigation.podspec'

到我的 ios 目录中的 Podfile 为我解决了 XCode 错误。添加此行后,您必须运行

pod install从 ios 目录中

react-native-navigation 文档说新版本的 react-native 将使用 pod。您可以在使用 CocoaPods 安装部分下看到它

https://wix.github.io/react-native-navigation/#/docs/Installing

于 2019-10-10T19:57:45.603 回答
1

将此行添加到您的 podfile

pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'

然后使用以下命令导入文件:

#import <React/RCTLinkingManager.h>
于 2021-06-23T09:45:29.767 回答