反应本机启动画面未找到“React/RCTBridgeModule.h"文件 [英] react native splash screen get 'React/RCTBridgeModule.h' file not found

查看:65
本文介绍了反应本机启动画面未找到“React/RCTBridgeModule.h"文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 :

react-native init myApplication

我从闪屏开始,所以我使用了这个库 react native spalsh screen

I started with splash screen so i used this library react native spalsh screen

我使用以下命令链接了库以生成本机代码:

I linked the library to generate native code using this command :

react-native link react-native-splash-screen

我像这样使用 Xcode 添加文件:

And i added files using Xcode like this :

  1. 在 XCode 的项目导航器中,右键单击 Libraries ➜ Add Files to [your project's name]
  2. 转到 node_modules ➜ react-native-splash-screen 并添加 SplashScreen.xcodeproj
  3. 在 XCode 的项目导航器中,选择您的项目.将 libSplashScreen.a 添加到项目的构建阶段 ➜ 将二进制文件与库链接
  4. 要修复未找到的RNSplashScreen.h"文件,您必须选择您的项目→构建设置→搜索路径→要添加的标题搜索路径:$(SRCROOT)/../node_modules/react-native-splash-screen/ios

我在真正的 Iphone 中使用 Xcode 构建应用程序,但在 RNSplashScreen.h 中出现此错误:

I build the app using Xcode in a real Iphone and i get this error in RNSplashScreen.h :

    /**
 * SplashScreen
 * 启动屏
 * from:http://www.devio.org
 * Author:CrazyCodeBoy
 * GitHub:https://github.com/crazycodeboy
 * Email:crazycodeboy@gmail.com
 */
#import <React/RCTBridgeModule.h> // <------'React/RCTBridgeModule.h' file not found
#import <UIKit/UIKit.h>

@interface RNSplashScreen : NSObject<RCTBridgeModule>
+ (void)showSplash:(NSString*)splashScreen inRootView:(UIView*)rootView;
+ (void)show;
+ (void)hide;
@end

未找到React/RCTBridgeModule.h"文件

'React/RCTBridgeModule.h' file not found

Podfile:

    pod 'React', :path => '../node_modules/react-native/'
    pod 'React-Core', :path => '../node_modules/react-native/React'
    ...... # other libaries
    pod 'react-native-splash-screen', :path => '../node_modules/react- 
    native-splash-screen'

AppDelegate.m :

AppDelegate.m :

#import "AppDelegate.h"

#import <React/RCTBridge.h>
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>
#import "RNSplashScreen.h"

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
  ....  <------- other code
  [RNSplashScreen show];
  return YES;
}

推荐答案

代替

#import <React/RCTBridgeModule.h>

使用

#import "RCTBridgeModule.h"

希望对你有帮助.如有疑问,请随意.

Hope this helps you. Feel free for doubts.

这篇关于反应本机启动画面未找到“React/RCTBridgeModule.h"文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆