facebook / react-native

A framework for building native applications using React
https://reactnative.dev
MIT License
119.17k stars 24.32k forks source link

Build failed iOS in Xcode 12.5 beta No matching function for call to 'RCTBridgeModuleNameForClass' #31432

Closed artyom-developer closed 3 years ago

artyom-developer commented 3 years ago

Description

i updated xcode 11.* to xcode 12.5 beta and after update i build app iOS but report error ==> No matching function for call to 'RCTBridgeModuleNameForClass'

React Native version:

System: OS: macOS 11.2.3 CPU: (4) x64 Intel(R) Core(TM) i5-5250U CPU @ 1.60GHz Memory: 293.65 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 12.18.2 - /usr/local/bin/node npm: 6.14.5 - /usr/local/bin/npm Watchman: 4.7.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 IDEs: Android Studio: 3.4 AI-183.6156.11.34.5522156 Xcode: 11.5/11E608c - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1

gstvds commented 3 years ago

@artyom-developer Did you find a solution? Same issue here

anttimo commented 3 years ago

@gstvds I ended up using this https://github.com/facebook/react-native/issues/28405#issuecomment-779382959 and adding the extra replace to it as guided in here https://github.com/facebook/react-native/issues/28405#issuecomment-827424477

gstvds commented 3 years ago

@anttimo It worked here! Thank you

remylavergne commented 3 years ago

Solution from https://github.com/facebook/react-native/issues/28405#issuecomment-827424477 didn't work for me, at first.

But, I realized, after some times, that keyword in replacement function was not matching my problem...

Solution given :

post_install do |installer|
     ## Fix for XCode 12.5
     find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
    "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
    find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
    "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
end

Working for me for react-native v0.62.2:

// ...
     "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
end

🤡 module -> strongModule in the original file...

Hope it can helps ;)

artyom-developer commented 3 years ago

Solution from #28405 (comment) didn't work for me, at first.

But, I realized, after some times, that keyword in replacement function was not matching my problem...

Solution given :

post_install do |installer|
     ## Fix for XCode 12.5
     find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
    "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
    find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
    "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
end

Working for me for react-native v0.62.2:

// ...
     "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
end

module -> strongModule in the original file...

Hope it can helps ;)

try again update xcode

artyom-developer commented 3 years ago

Solution from #28405 (comment) didn't work for me, at first.

But, I realized, after some times, that keyword in replacement function was not matching my problem...

Solution given :

post_install do |installer|
     ## Fix for XCode 12.5
     find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
    "_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules", "_initializeModules:(NSArray<Class> *)modules")
    find_and_replace("../node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
    "RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass(Class(module)))")
end

Working for me for react-native v0.62.2:

// ...
     "RCTBridgeModuleNameForClass(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
end

module -> strongModule in the original file...

Hope it can helps ;)

https://github.com/facebook/react-native/issues/28405#issuecomment-827424477

infinitbility commented 3 years ago

Check the below article to solve the build update issue in code 12.5

https://infinitbility.com/build-failed-after-update-xcode-12.5

coolvasanth commented 3 years ago

Tried the most popular solution of replace which is propose above, but no luck. I'm using react-native version 0.62.2, anyone else facing same problem ?? any solution will be highly appreciated.

haider792 commented 3 years ago

Replace

with :

in file named RCTCxxBridge.mm at nearly line 770

after this in RCTTurboModuleManager.mm file change the following

 "RCTBridgeModuleNameForClass(what ever module name is))", 

with

"RCTBridgeModuleNameForClass(Class(what ever module name is)))") nearly at line 300

hollystandring commented 3 years ago

Replace

* (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id> *)modules

with :

* (NSArray<RCTModuleData *> *)_initializeModules:(NSArray *)modules

in file named RCTCxxBridge.mm at nearly line 770

after this in RCTTurboModuleManager.mm file change the following

 "RCTBridgeModuleNameForClass(what ever module name is))", 

with

"RCTBridgeModuleNameForClass(Class(what ever module name is)))") nearly at line 300

Can confirm this works for me :)