close

[Solved] React Native / iOS SDK. No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5

Hello Guys, How are you all? Hope You all Are Fine. Today when I run my App I got Error Message No matching function for call to ‘RCTBridgeModuleNameForClass’ in React Native. So Here I am Explain to you all the possible solutions here.

Without Wasting your time, Lets start This Article to Solve This Error.

How No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5 Error Occurs ?

After updating iOS SDK platform to version 14.5 And My xcode version 12.5, I cannot launch the application on my device. An error: No matching function for call to 'RCTBridgeModuleNameForClass'.

How To Solve No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5 Error in React navtive ?

Question: How To Solve No matching function for call to ‘RCTBridgeModuleNameForClass’ after update iOS SDK to 14.5 Error in React navtive ?
Answer: First Of all Open your Podfile in your React Native project. Add this code at the bottom of your ios/Podfile. Save Podfile. after that run pod install on terminal. Then run/build your project again!

Solution 1

Step 1: First Of all Open your Podfile in your React Native project.

Step 2: Add 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

Step 3: Save Podfile.

Step 4: after that run pod install on terminal

Step 5: Then run/build your project again!

Solution 2

Add this in your Podfile.

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

After That you will find 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 commented out the line # flipper_post_install(installer) inside post_install do |installer|

Last, re-install your pods, rebuil and run your project.

Summery

It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?

Also Read

Leave a Comment