Cli: XCode 12.5 failed build. Cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *'

Created on 28 Apr 2021  路  1Comment  路  Source: react-native-community/cli

Environment

react-native 0.61.5

Description

Downloaded final version XCode 12.5 after build I had a troubles with this.

  // Initialize all native modules that cannot be loaded lazily
  (void)[self _initializeModules:RCTGetModuleClasses() withDispatchGroup:prepareBridge lazilyDiscovered:NO];
  [self registerExtraLazyModules];

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

Reproducible Demo

Just instal XCode 12.5 final version from AppStore and try to build project.

bug report

Most helpful comment

I've got the same problem.

Found the official fix on react-native repo.

Convert it for react-native 61.5, give this.

diff --git a/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm b/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
index bd48f44..d243ed0 100644
--- a/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
+++ b/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
@@ -767,7 +767,7 @@ - (void)registerExtraLazyModules
 #endif
 }

-- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
+- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<Class> *)modules
                                withDispatchGroup:(dispatch_group_t)dispatchGroup
                                 lazilyDiscovered:(BOOL)lazilyDiscovered
 {
diff --git a/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm b/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
index 3cb73b5..edff4b2 100644
--- a/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
+++ b/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
@@ -297,7 +297,7 @@ - (void)notifyAboutTurboModuleSetup:(const char *)name
           @"%@ has no setter or ivar for its bridge, which is not "
            "permitted. You must either @synthesize the bridge property, "
            "or provide your own setter method.",
-          RCTBridgeModuleNameForClass(module));
+          RCTBridgeModuleNameForClass([module class]));
     }
   }

Using patch-package to commit the fix in my project.

>All comments

I've got the same problem.

Found the official fix on react-native repo.

Convert it for react-native 61.5, give this.

diff --git a/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm b/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
index bd48f44..d243ed0 100644
--- a/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
+++ b/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
@@ -767,7 +767,7 @@ - (void)registerExtraLazyModules
 #endif
 }

-- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
+- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<Class> *)modules
                                withDispatchGroup:(dispatch_group_t)dispatchGroup
                                 lazilyDiscovered:(BOOL)lazilyDiscovered
 {
diff --git a/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm b/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
index 3cb73b5..edff4b2 100644
--- a/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
+++ b/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
@@ -297,7 +297,7 @@ - (void)notifyAboutTurboModuleSetup:(const char *)name
           @"%@ has no setter or ivar for its bridge, which is not "
            "permitted. You must either @synthesize the bridge property, "
            "or provide your own setter method.",
-          RCTBridgeModuleNameForClass(module));
+          RCTBridgeModuleNameForClass([module class]));
     }
   }

Using patch-package to commit the fix in my project.

Was this page helpful?
0 / 5 - 0 ratings