1

在做一个 react-native 链接以链接我的 package.json 中的字体资产后:

"rnpm": {
   "assets": ["./assets/fonts/"]
}

尝试运行 react-native run-ios 时,我在 xcode 中遇到了几个错误:

类“RCTBridge”的重复接口定义

在此处输入图像描述

如果你们有任何线索,这似乎是包含文件的问题。

谢谢

4

1 回答 1

0

我有同样的问题。

在我的情况下,添加 react-native-fabric 库后会出现问题。
所以我正在执行以下步骤。

1) 打开SMXAnswers.h然后将#import "RCTBridgeModule.h"更改为

#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#else
#import "RCTBridgeModule.h"
#endif

2)打开SMXAnswers.m然后更改以下

#import "RCTBridgeModule.h"  
#import "RCTEventDispatcher.h"  
#import "RCTBridge.h"

#if __has_include(<React/RCTBridgeModule.h>)
#import <React/RCTBridgeModule.h>
#else
#import "RCTBridgeModule.h"
#endif

#if __has_include(<React/RCTBridge.h>)
#import <React/RCTBridge.h>
#else
#import "RCTBridge.h"
#endif

#if __has_include(<React/RCTEventDispatcher.h>)
#import <React/RCTEventDispatcher.h>
#else
#import "RCTEventDispatcher.h"
#endif

它可能会解决您的问题。
这个解决方案对我有用。

于 2018-08-13T07:04:38.110 回答