如何解决React Native iOS链接错误::找不到'ReactNativeNavigation / ReactNativeNavigation.h'文件?

时间:2019-02-22 06:41:47

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

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

我在iOS链接中遇到问题。

  

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

     

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

我也关注了上一篇文章,但不适用于我link 我正在为我的应用程序(使用Xcode的iOS)设置React Native Navigation。

我已经在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平台解决此问题。

2 个答案:

答案 0 :(得分:1)

将此行添加到您的 podfile

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

然后导入文件:

#import <React/RCTLinkingManager.h>

答案 1 :(得分:0)

我还有其他构建问题,但添加了一行

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