react-native: 0.61.5 → 0.62.0 RCTBridgeModule Error
I upgrade 0.61.5 → 0.62.0 version but getting below error
cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong' NSArray<RCTModuleData *> *newModules = [self _initializeModules:modules withDispatchGroup:NULL lazilyDiscovered:YES];
React Native Info:
System:
OS: macOS 10.15.3
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 63.01 MB / 8.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 10.15.3 - /usr/local/bin/node
Yarn: 1.15.2 - ~/.yarn/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
Watchman: Not Found
SDKs:
iOS SDK:
Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
Android SDK:
API Levels: 23, 25, 26, 27, 28, 29
Build Tools: 27.0.3, 28.0.3, 29.0.0, 29.0.1, 29.0.2
System Images: android-27 | Google Play Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.6010548
Xcode: 11.3.1/11C504 - /usr/bin/xcodebuild
Languages:
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.62.0 => 0.62.0
npmGlobalPackages:
*react-native*: Not Found
This line:
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 60 (2 by maintainers)
Commits related to this issue
- Xcode 12.5 빌드 에러 대응 https://github.com/facebook/react-native/issues/28405#issuecomment-779382959 — committed to team-olulo/react-native-naver-map by plaredspear 3 years ago
- Xcode 12.5 빌드 에러 대응 https://github.com/facebook/react-native/issues/28405#issuecomment-779382959 — committed to plaredspear/react-native-naver-map by plaredspear 3 years ago
This was fixed in the new rn version but if you don’t want to upgrade
Add this post install script to your Podfile:
End of the Podfile add this function:
After adding this script, just run pod install command.
Happy Coding ❤️
Use
patch-packages
! I think writing above codes on thePodfile
is not sure. Because above solution are the code that simply replace part of codes on thenode_modules/react-native
. This is not a responsibility ofPodfile
.Here’s my solution.
yarn add -D patch-package
node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm
and replace_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
to_initializeModules:(NSArray<Class> *)modules
node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm
and replaceRCTBridgeModuleNameForClass(module))
toRCTBridgeModuleNameForClass(Class(module)))
yarn patch-package react-native
You can try this. Using post install script of @edrdesigner above
Hope this helps
I had two issues, these replaces did the job:
Congrats to Xcode that makes me lost many hours trying to solve a fucking issue that didn’t exist before
Hi everyone! I’m running RN v0.61.5 and this is what worked for me:
Notice the
RCTBridgeModuleNameForClass([module class]))
instead of theRCTBridgeModuleNameForClass(Class(module)))
of other solutions above.And at the very end of the Podfile:
Thanks to all the ones who contributed to this thread!
Note: The
patch-package
solution didn’t work for me, I don’t really know why. The patch section for the fileRCTTurboModuleManager.mm
was generated but always returned an error at the moment of patching.@edrdesigner Build failed No matching function for call to ‘RCTBridgeModuleNameForClass’
Heeeelp how to fix this problem?
Having same problem here, but im at .61, the problem is with Xcode 12.5, the last version 12.4 didnt have this problem.
So I was able to fix it by this code
inserted iside
post_install do |installer|
If you also getting
'atomic_notify_one<unsigned long>' is unavailable
Do this as temporary fix.You have to define the replace function as well (at the bottom of the Pods file):
From the comment of @devethan I propose this bash script to be launched from root of the project:
Using
patch-package
should be the preferred way, but for someone like me that for some reasons couldn’t usepatch-package
, this script could be a valid alternative. I put it in thepost-install
into package.json.This works great for me 💯
Thank you @devethan . Your solution worked for me.
I fix with RTCTTurboModuleManager.mm file 307:
RCTBridgeModuleNameForClass(strongModule));
to 307: RCTBridgeModuleNameForClass([strongModule class]));Make sure you run
pod repo update
in the ios dirMake Sure the two scripts are at the bottom of your pod-file and then use this as the post_installer script
post_install do |installer| 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
instead of Module for RCTBridgeModuleNameForClass its been updated to strongModule which worked for me
I resolved the issue by this method and it’s working pretty well in my side
In some cases, you may also need this third one 😃
post_install do |installer| … find_and_replace(“…/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm”, “RCTBridgeModuleNameForClass(strongModule))”, “RCTBridgeModuleNameForClass(Class(strongModule)))”) end
did you solve your issue?
Unfortunately @crobinson42,
pod repo update
didn’t work. I am getting same error from this lines;https://github.com/facebook/react-native/blob/6ce3f0a4f7495adb82e655d037dc4e5af462f955/React/CxxBridge/RCTCxxBridge.mm#L329
https://github.com/facebook/react-native/blob/6ce3f0a4f7495adb82e655d037dc4e5af462f955/React/CxxBridge/RCTCxxBridge.mm#L773
https://github.com/facebook/react-native/blob/6ce3f0a4f7495adb82e655d037dc4e5af462f955/React/CxxBridge/RCTCxxBridge.mm#L832
Same here. Xcode 12.5 beta specific problem. Here is change log, just in case.
@devethan is the man!!
Did we able to solve this issue? I am also facing same issue on xcode 12.5 beta.
Was heplful. Thank you.
dont think like that. As a developer you and everyone is trying to do something like they do. which we are giving some releases or updates to relevant clients, it can be a developer or customer or whoever just imaging someone blaming you for a buggy app or website. you know how much hard work behind that small update. look how many answers are there. rather than blaming just do some work around and be patient.
thanks @edgarbonillag I confirm your fix works for RN 0.61.5
@devethan thank you. you save my day
@devethan Thank you good sir. It works.
Worked for me perfectly. Thx @devethan
this solution ^^ by @devethan is the right approach! 💯 Fixed the issue for me!
@TheSavior I didn’t try on new project. I will open this issue in
upgrade-support