no matching function for call to rctbridgemodulenameforclass

Cause of error no matching function for call to rctbridgemodulenameforclass

This error no matching function for call to rctbridgemodulenameforclass appears while launching any application on your device. Many people try to solve this error by updating their iOS SDK platform to the upgraded version.

 

Then too there are not able to solve this error. Not only this sometimes updating the XCode version also does not work. This will result in the error line:

 

No matching function for call to ‘RCTBridgeModuleNameForClass’

 

One can try installing pods again to solve this error, but this also sometimes does not work. The error image comes as follows:

no matching function for call to rctbridgemodulenameforclass

Solution:

There are varieties of options to solve this issue. The very first one is by putting the following code at the bottom of the ios or 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

 

The next step is to save this code and install the pod on the terminal. After completing the following steps try to run your application once again.

The second solution can be to run the pod_install function but instead of writing a module try writing a strong module.

 

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

 

The third solution is by using the code from Xcode throwing’ atomic_notify_one’ and then commenting out the flipper_post_install(installer) and then running the application.

 

The last one is to run the following code by changing the name of the variables from RCTBridgeModuleNameForClass(module)) to RCTBridgeModuleNameForClass(strongModule)) and from RCTBridgeModuleNameForClass(Class(module))) to RCTBridgeModuleNameForClass(Class(strongModule))).

 

post_install do |installer|
     # Fix after updating to Xcode 13.1
     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

 

 

Also Read: pip install alpaca trade api

 

 

Share this post

5 thoughts on “no matching function for call to rctbridgemodulenameforclass

Leave a Reply

Your email address will not be published. Required fields are marked *