React Native App no longer builds after upgrading to XCode 12.5

My react native app previously built and ran on a simulator in xcode 11. However sine upgrading to xcode 12.5 i get the following build errors


Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an rvalue of type 'NSArray<Class>*'

Cannot initialize a parameter of type 'NSArray<Class> *' with an lvalue of type 'NSArray<id<RCTBridgeModule>> *__strong'

Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong'




change RCTCxxBridge.mm 624 line
Code Block Objective-C
NSArray<id<RCTBridgeModule>> *)modules

to
Code Block Objective-C
NSArray<Class> *)modules



Hi,

I have the same issue with Xcode 13.1 on my react native projet.

***/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:331:34: Cannot initialize a parameter of type 'NSArray<id> *' with an rvalue of type 'NSArray *'

***/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:776:79: Cannot initialize a parameter of type 'NSArray *' with an lvalue of type 'NSArray<id> *__strong'

***/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:827:69: Cannot initialize a parameter of type 'NSArray<id> *' with an lvalue of type 'NSArray *__strong'

In my RCTCxxBridge.mm file, I don't find the ligne 624 with "NSArray<id> *)modules" but "NSArray *moduleClassesCopy = [moduleClasses copy];".

I have searched "NSArray<id> *" on this file and found 2 results : (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id> *)modules withDispatchGroup:(dispatch_group_t)dispatchGroup lazilyDiscovered:(BOOL)lazilyDiscovered (line 771)

AND

NSArray<id> *extraModules = nil; (line 669)

I changed them by : (NSArray<RCTModuleData *> *)_initializeModules:(NSArray *)modules withDispatchGroup:(dispatch_group_t)dispatchGroup lazilyDiscovered:(BOOL)lazilyDiscovered

AND

NSArray *extraModules = nil;

Now I have those errors : ***/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:671:20: Incompatible pointer types assigning to 'NSArray *' from 'NSArray<id> *'

AND

***/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:673:20: Incompatible pointer types assigning to 'NSArray *' from 'NSArray<id> *'

Could you help me, please ?

after applying this solution we think problem is solved but while archiving in xcode 13 we get errors for RCTViewManager.h not found (i double checked the file is their). and also other anyname.h file not found error occurs so give proper or end to end solution.

React Native App no longer builds after upgrading to XCode 12.5
 
 
Q