Closed
Description
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:
react-native/React/CxxBridge/RCTCxxBridge.mm
Line 778 in 6ce3f0a
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
label-actions commentedon Mar 26, 2020
react-native info
in a console.crobinson42 commentedon Mar 27, 2020
Make sure you run
pod repo update
in the ios direrdemildiz commentedon Mar 27, 2020
Unfortunately @crobinson42,
pod repo update
didn't work. I am getting same error from this lines;react-native/React/CxxBridge/RCTCxxBridge.mm
Line 329 in 6ce3f0a
react-native/React/CxxBridge/RCTCxxBridge.mm
Line 773 in 6ce3f0a
react-native/React/CxxBridge/RCTCxxBridge.mm
Line 832 in 6ce3f0a
elicwhite commentedon Mar 27, 2020
Do you see this problem when creating a new project? If this issue doesn't occur in a new project, I recommend you create an issue on the upgrade-support repo instead. Sharing your issues when upgrading on that repo will improve the likelihood that you will find others with the same problem and find fixes. It also helps others find you! 😄
erdemildiz commentedon Mar 27, 2020
@TheSavior I didn't try on new project. I will open this issue in
upgrade-support
pjhaok commentedon Feb 14, 2021
Did we able to solve this issue? I am also facing same issue on xcode 12.5 beta.
damikdk commentedon Feb 14, 2021
Same here. Xcode 12.5 beta specific problem. Here is change log, just in case.
56 remaining items
Xcode 12.5 빌드 에러 대응
allthetime commentedon May 28, 2021
@russelRajitha Well said! We're all in this together. I was very frustrated 20 minutes ago when I encountered these issues after upgrading macOS and XCode. But I have had issues like this before and I know that it's something to do with react-native & XCode compatibility and because of that that many people would have the same problem. Also, blaming XCode is missing the point... XCode doesn't exist solely to compile react-native apps and breaking changes to complex systems in constant development should be expected. React-native developers fixed the issue in the latest versions and so it seems entirely on the user to either upgrade, or to just humbly take the help of thousands of people that is readily available.
BenShelton commentedon Jun 5, 2021
If you are using a much older version of react-native (I was on
0.54.4
😬 ) then the name of the method may be_initModules
instead of_initializeModules
. AndRCTTurboModuleManager
doesn't even exist. Plus I was on a version before thePodfile
was a thing 😅So I adjusted the script @strawberry-code mentioned above and now run this on a
postinstall
script inpackage.json
:There's more patches in this script in reality (to patch other things that have broken over the years) but this part addresses this specific issue.
prateekchitransh1907 commentedon Jun 7, 2021
You da man !!
Hudamp commentedon Jun 10, 2021
where to add the first code?
AbhilashPurohith commentedon Jun 15, 2021
change RCTCxxBridge.mm in line number 624
NSArray<id> *)modules
to
*NSArray )modules
Jackyaung commentedon Jun 22, 2021
hi I got another problem after add below codes in podfile, the problem is "main.jsbundle does not exist. This must be a bug with", I have tried all most every way posted online, it didn't solve the problem. my react native version is 61.5.
post_install do |installer|
## Fix for XCode 12.5 beta
find_and_replace("../node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray<id> *)modules", "_initializeModules:(NSArray *)modules")
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
sbrighiu commentedon Jun 26, 2021
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
romreed commentedon Jul 15, 2021
Was heplful. Thank you.
bullerliu commentedon Jul 22, 2021
post_install do |installer|
## Fix for XCode 12.5
find_and_replace("./RNLib/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm",
"_initializeModules:(NSArray *)modules", "_initializeModules:(NSArray *)modules")
find_and_replace("./RNLib/node_modules/react-native/ReactCommon/turbomodule/core/platform/ios/RCTTurboModuleManager.mm",
"RCTBridgeModuleNameForClass(module))", "RCTBridgeModuleNameForClass([module class]))")
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.0'
end
end
end
这样写没有用
oluoyefeso commentedon Aug 12, 2021
Experienced this same issue and this worked for me:
And at the end of the Podfile:
luccaroli commentedon Sep 30, 2021
it's worked for me, thanks