【问题标题】:How to resolve React Native iOS linking error:: 'ReactNativeNavigation/ReactNativeNavigation.h' file not found?如何解决 React Native iOS 链接错误:: 'ReactNativeNavigation/ReactNativeNavigation.h' 文件未找到?
【发布时间】:2019-07-16 05:10:13
【问题描述】:

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

【问题讨论】:

  • 确保libReactNativeNavigation.a 包含在主要项目Link Binary With Libraries 部分中。
  • 是的,我已将它从 ReactNativeNavigation.xcodeproj -> Poducts -> libReactNativeNavigation.a 拖放到右侧窗格部分的 Link Binary With Libraries。现在它被标记为必填
  • 祝你好运@ArchanaSharma
  • 我已经清理了我的项目,然后删除了所有对 react native 导航库的引用并重新添加了库,它为我解决了问题。
  • 您应该在文档中执行步骤 3.a。

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


【解决方案1】:

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

pod 'ReactNativeNavigation', :podspec =&gt; '../node_modules/react-native-navigation/ReactNativeNavigation.podspec'

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

pod install 来自 ios 目录

react-native-navigation 文档说新版本的 react-native 将使用 pod。你可以在 Installation with CocoaPods 部分看到它

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

【讨论】:

    【解决方案2】:

    将此行添加到您的 podfile 中

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

    然后导入文件:

    #import <React/RCTLinkingManager.h>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-06-19
      • 2019-08-10
      • 1970-01-01
      • 1970-01-01
      • 2019-02-14
      • 1970-01-01
      • 1970-01-01
      • 2021-04-18
      相关资源
      最近更新 更多