. Advertisement .
..3..
. Advertisement .
..4..
This error can frequently occur when you run the program: No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5.
This is a popular error made by many coders. So, why did the error occur, and how could it be resolved? We’ll talk about everything with you.
Why Does The Error “No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5” occur?
You cannot launch the application on your device after updating the iOS SDK platform to version 14.5 and my Xcode to version 12.5.
No matching function for call to 'RCTBridgeModuleNameForClass'.
Some Fundamental Methods
And, you know what, you might be able to solve that with some simple ways. We can better understand these solutions by using the cases below.
Method 1:
- Open your Podfile in your React Native project first.
- Copy and paste this code at the bottom of your iOS/Podfile.
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
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
3. Conserve the Podfile.
4. Finally, use the terminal to run pod install.
5. Re-run/build your project!
Method 2:
Add this code in your Podfile.
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(strongModule))", "RCTBridgeModuleNameForClass(Class(strongModule)))")
end
def find_and_replace(dir, findstr, replacestr)
Dir[dir].each do |name|
text = File.read(name)
replace = text.gsub(findstr,replacestr)
if text != replace
puts "Fix: " + name
File.open(name, "w") { |file| file.puts replace }
STDOUT.flush
end
end
Dir[dir + '*/'].each(&method(:find_and_replace))
end
Following that, you will notice an error related to Flipper:
Flipper-Folly/folly/synchronization/DistributedMutex-inl.h:1051:5: 'atomic_notify_one<unsigned long>' is unavailable
# Enables Flipper.
#
# Note that if you have use_frameworks! enabled, Flipper will not work and
# you should disable the next line.
# use_flipper!()
And removed the line # flipper post install(installer) within post install do |installer|.
Finally, reinstall your pods, recompile, and run your project.
Method 3:
1. yarn add -D patch-package
2. Go to node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
Change _initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
to _initializeModules:(NSArray<Class> *)modules
3. Go to node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
Change RCTBridgeModuleNameForClass(module))
to RCTBridgeModuleNameForClass(Class(module)))
4. yarn patch-package react-native
Conclusion
In short, the solutions mentioned above have been the most effective for individuals who are still perplexed by this error: No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5.
When you still seek help or have other questions, we have a big community where everyone is always willing to help. Finally, we hope all readers have a fantastic day with innovative code solutions.
Leave a comment