You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native物理设备Hot reload功能失效问题求助

问题:iOS 17.4.1物理设备上React Native Hot Reload与开发工具失效

问题描述

  • 在运行iOS 17.4.1的iPhone 12物理设备上启动React Native项目,应用可正常运行,但Hot reload功能和开发工具完全失效,无法高效调试。
  • 预期行为:物理设备上运行应用时,Hot reload与开发工具保持激活状态,支持调试开发。
  • 实际行为:指定设备运行后,Hot reload及开发工具被禁用,阻碍调试流程。
  • 关键情况:仅物理设备出现此问题,模拟器运行完全正常。

补充信息

  • 多次尝试后问题仍持续存在
  • 操作过程中未显示任何错误信息或警告提示
  • 模拟器运行应用无异常

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!

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 'KtdraApp' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'KtdraAppTests' do
    inherit! :complete
    # Pods for testing
  end

  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

React Native 版本

0.72.6

环境信息(npx react-native info 输出)

System:
  OS: macOS 14.4.1
  CPU: (8) arm64 Apple M2
  Memory: 68.47 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.18.2
    path: ~/.nvm/versions/node/v18.18.2/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.nvm/versions/node/v18.18.2/bin/yarn
  npm:
    version: 9.8.1
    path: ~/.nvm/versions/node/v18.18.2/bin/npm
  Watchman:
    version: 2024.04.01.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.4
      - iOS 17.4
      - macOS 14.4
      - tvOS 17.4
      - visionOS 1.1
      - watchOS 10.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 15.3/15E204a
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.22
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.6
    wanted: 0.72.6
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

相关日志

info Building (using "xcodebuild -workspace KtdraApp.xcworkspace -configuration Debug -scheme KtdraApp -destination id=00008101-001608AA0A2B001E")
success Successfully built the app
info Installing and launching your app on iPhone
success Installed the app on the device.
warn No apps connected. Sending "devMenu" to all React Native apps failed. Make sure your app is running in the simulator or on a phone connected via USB.

已尝试的解决方法

  • 修改Xcode scheme
  • 使用其他项目模板重新创建项目
  • 升级React Native版本
  • 在iPad及其他物理设备上测试

内容的提问来源于stack exchange,提问作者Luis Angel Ramirez Calderon

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.26 13:26:05