Duplicate interface definition for class 'RCTBridge' error after react-native link

2.2k Views Asked by At

After doing a react-native link to link font assets in my package.json :

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

I got several errors in xcode when trying to run react-native run-ios :

Duplicate interface definition for class 'RCTBridge'

enter image description here

It seems to be a problem with include files, if you guys have any clues ..

Thx

1

There are 1 best solutions below

0
On

I had same issue.

In my case that problem occur after add react-native-fabric library.
So I'm do following steps.

1) open SMXAnswers.h then change #import "RCTBridgeModule.h" to

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

2) open SMXAnswers.m then change following

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

to

#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

It's may solve your issue.
This solution is working for me.