https://github.com/facebook/react-native/issues/36611
我尝试了这里的一切,但对我不起作用。 人们在将 React Native 升级到新版本时遇到了问题,但我还没有进行升级。 0.71版本后出现问题,但我不知道该怎么办我只升级到Xcode 16
Podfile
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
# Prepare React Native project
prepare_react_native_project!
# Framework linkage configuration
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
# Main target configuration
target 'yourappname' do
config = use_native_modules!
# Use frameworks with static linkage
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
# Use React Native settings
use_react_native!(
:path => config[:reactNativePath],
# Specify the absolute path to the application root
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
# Tests target configuration
target 'yourappnameTests' do
inherit! :complete
# Pods for testing
end
end
# Post-installation configurations
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
# Exclude arm64 architecture for iPhone Simulator
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
end
npx 反应本机信息
info Fetching system and libraries information...
System:
OS: macOS 14.5
CPU: (12) arm64 Apple M2 Pro
Memory: 61.25 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.20.4
path: ~/.nvm/versions/node/v18.20.4/bin/node
Yarn: Not Found
npm:
version: 10.9.1
path: ~/node_modules/.bin/npm
Watchman: Not Found
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.1
- iOS 18.1
- macOS 15.1
- tvOS 18.1
- visionOS 2.1
- watchOS 11.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10811636
Xcode:
version: 16.1/16B40
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.10
path: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
Ruby:
version: 2.6.10
path: /usr/bin/ruby
npmPackages:
"@react-native-community/cli":
installed: 15.0.1
wanted: 15.0.1
react:
installed: 18.3.1
wanted: 18.3.1
react-native:
installed: 0.76.3
wanted: 0.76.3
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: true
newArchEnabled: true
iOS:
hermesEnabled: true
newArchEnabled: true
package.json
"dependencies": {
"@react-native-async-storage/async-storage": "^2.1.0",
"@react-native-firebase/app": "^19.0.0",
"@react-native-firebase/auth": "^19.0.0",
"@react-native-firebase/firestore": "^19.0.0",
"@react-navigation/bottom-tabs": "^7.0.12",
"@react-navigation/native": "^7.0.7",
"@react-navigation/native-stack": "^7.1.8",
"axios": "^1.7.8",
"moment": "^2.30.1",
"react": "18.3.1",
"react-native": "0.76.3",
"react-native-calendars": "^1.1286.0",
"react-native-gesture-handler": "^2.21.2",
"react-native-get-random-values": "^1.11.0",
"react-native-linear-gradient": "^2.8.3",
"react-native-pdf": "^6.7.5",
"react-native-reanimated": "^3.16.3",
"react-native-safe-area-context": "^4.14.0",
"react-native-screens": "^4.3.0",
"react-native-svg": "^15.9.0",
"react-native-uuid": "^2.0.3",
"react-native-vector-icons": "^10.2.0",
"react-native-video": "^6.8.2",
"react-native-webview": "^13.12.4"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@react-native/babel-preset": "0.76.3",
"@react-native/eslint-config": "0.76.3",
"@react-native/metro-config": "0.76.3",
"@react-native/typescript-config": "0.76.3",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.3.1",
"typescript": "5.0.4"
},
当前版本如下,现在找到了 RCTAppDelegate.h 文件,但是仍然没有找到 RCTBridgeDelegate.h 文件。像这样更新 Podfile 对我来说就足够了。
podfile
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, '15.1'
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'yourAppName' do
config = use_native_modules!
use_frameworks! :linkage => :static
$RNFirebaseAsStaticFramework = true
pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
pod 'React-RCTAppDelegate', :path => '../node_modules/react-native/Libraries/AppDelegate'
pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules'
pod 'React-Core', :path => '../node_modules/react-native/'
use_react_native!(
:path => "../node_modules/react-native",
:hermes_enabled => false,
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
target 'YourAppTests' do
inherit! :complete
# Pods for testing
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['EXCLUDED_ARCHS[sdk=iphonesimulator*]'] = 'arm64'
end
end
end