[英]React-native cannot open ios simulator debug menu
我有一个 react-native 项目,我使用 ios 模拟器(主要是 iPhone 8)开发。 我似乎无法使用常规命令 ⌘ + D 打开调试菜单。
我最近开始应用 pod 作为在我的项目中集成依赖项的一种方式,因为我需要一个需要它的特定库。 更改后,我再也无法使用 ⌘ + D 和 ⌘ + R 等控件打开调试菜单(也无法刷新模拟器应用程序)。 我也尝试从模拟器顶部菜单中打开那些,但没有运气。 摇动手势也不起作用,那里没有运气。
我运行我的应用程序的方式如下:
ENVFILE=.env.ios-development react-native run-ios --simulator 'iPhone 8'
我认为它应该解析为调试模式而不是发布模式? 因为可以解释为什么无法打开调试菜单的一件事是应用程序处于发布模式,其中不支持调试菜单。 但这不应该是这样,因为我只是使用基本的react-native run-ios
命令运行它。 我怎么能 100% 确定它没有处于发布模式? 我可以从应用程序中打开一个警报来测试它(因为 console.log 不会显示,因为无法进入调试菜单)。 同样,一旦我启动应用程序,它就会在终端中显示:
使用“xcodebuild -workspace MyApp.xcworkspace -configuration Debug -scheme MyApp -destination id=356D169E-E11E-44B2-8AEF-015D0F24A203 -derivedDataPath build/MyApp”构建信息
带有 Debug 值的 -configuration 标志将表明它不在发布模式下。
我的 Podfile 如下所示:
project 'MyApp.xcworkspace'
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
# Allowed sources
source 'https://github.com/CocoaPods/Specs.git'
target 'myapp' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for myapp
# Point to the installed version
pod 'RNDateTimePicker', :path => '../node_modules/@react-native-community/datetimepicker/RNDateTimePicker.podspec'
# React/React-Native specific pods
pod 'React', :path => '../node_modules/react-native', :subspecs => [
'Core',
'CxxBridge', # Include this for RN >= 0.47
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
'RCTText',
'RCTNetwork',
'RCTWebSocket', # Needed for debugging
]
# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
# Third party deps podspec link
pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
target 'myapp-tvOSTests' do
inherit! :search_paths
# Pods for testing
end
target 'myappTests' do
inherit! :search_paths
# Pods for testing
end
end
难道是没有正确安装启用应用内调试菜单的DevSupport模块? 我的意思是这个:
'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
我已经尝试了许多类似问题的答案,但都没有成功。
我的 react-native 版本是:0.59.10
能够通过删除use_frameworks!
我的 Podfile 中的行。 我想我很幸运没有在我的应用程序中使用任何动态框架,所以能够用这个解决方案修复它。 但我知道这不是最优的。 因此,如果有人想出更好的选择,我可能会接受它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.