简体   繁体   English

无法再通过 CMD+D 打开开发菜单或通过 CMD+R 重新加载

[英]Can't open dev menu via CMD+D or reload via CMD+R any longer

I can't open my dev menu via CMD+D or reload via CMD+R any longer.我无法再通过 CMD+D 打开我的开发菜单或通过 CMD+R 重新加载。 It just stopped working without me knowingly changing something.它只是在我不知情的情况下停止工作。

Some more info:更多信息:

  • Shake gesture still works, but not always摇动手势仍然有效,但并非总是如此
  • Live reload works only when shake gesture is working实时重新加载仅在摇动手势有效时有效
  • Independent of build via react-native run-ios or via xCode独立于通过react-native run-ios或通过 xCode 构建
  • rn22.0 and rn23.0-rc rn22.0 和 rn23.0-rc
  • same behaviour upon react-native init newProject react-native init newProject上的相同行为
  • I use the workspace file我使用工作区文件

What I have tried to fix it:我试图解决的问题:

  • tried other simulators试过其他模拟器
  • downgrade/upgrades by a version按版本降级/升级
  • ran react-native upgrade and said yes to every overwrite运行react-native upgrade并对每次覆盖说yes
  • complete reinstall of all NPM modules完全重新安装所有 NPM 模块
  • Reset the simulator重置模拟器
  • clean build干净的构建
  • reboot重启

From Menu Bar, I/O -> Input -> Send Keyboard Input to Device.从菜单栏,I/O -> 输入 -> 将键盘输入发送到设备。 It really helps.这真的很有帮助。

Have you tried accessing the Simulators Hardware?您是否尝试过访问模拟器硬件?

Simulator > Hardware > Keyboard > Connect Hardware Keyboard模拟器 > 硬件 > 键盘 > 连接硬件键盘

I/O -> Input -> Send Keyboard Input to Device is not working properly always for me. I/O -> Input -> Send Keyboard Input to Device对我来说并不总是正常工作。

I use Device -> Shake to open the dev menu using the following shortcut:我使用Device -> Shake使用以下快捷方式打开开发菜单:

CMD+CTR+Z

This is indeed really annoying.这确实很烦人。 I figured out a solution I haven't seen here yet, and hope it helps anyone.我想出了一个我还没有在这里看到的解决方案,希望它可以帮助任何人。 Go to I/O -> Input -> Send Keyboard Input to Device .转到I/O -> Input -> Send Keyboard Input to Device And you'll see next time you press CMD+D or CMD+R it'll work.下次按CMD+DCMD+R时,您会看到它会起作用。 However, it somehow resets this every time.但是,它每次都会以某种方式重置它。 To overcome this, simply add a system keyboard shortcut :为了克服这个问题,只需添加一个系统键盘快捷键

Send Keyboard Input to Device => CMD+D Send Keyboard Input to Device => CMD+D

Now every time you press the shortcut, it'll also invoke that command to make sure the shortcut is sent to the app.现在,每次按下快捷方式时,它都会调用该命令以确保将快捷方式发送到应用程序。

See here for how to add system keyboard shortcut if need be.如果需要,请参阅此处了解如何添加系统键盘快捷键

I had the same issue with IOS Simulator.我对IOS模拟器有同样的问题。 First check your build type ie it is debug or release.首先检查您的构建类型,即它是调试还是发布。 For this为了这
i) Open your project in XCode and go to Product -> Scheme -> Edit Scheme and check the Build Configuration if it is Release then change it to the Debug because cmd+d or cmd+r commands are run only for debug mode release. i) 在 XCode 中打开您的项目,然后转到Product -> Scheme -> Edit Scheme并检查 Build Configuration 如果它是 Release,然后将其更改为 Debug,因为cmd+dcmd+r命令仅在调试模式发布时运行。
ii) If Build Configuration is already set to Debug then Restart your simulator by going to Hardware -> Restart This will resolve your issue. ii) 如果 Build Configuration 已经设置为 Debug,则通过转到Hardware -> Restart启动您的模拟器,这将解决您的问题。

In terminal, you can press "D" like below.在终端中,您可以按如下所示的“D”。

Loading dependency graph, done.

To reload the app press "r"
To open developer menu press "d"

info Opening developer menu...

One thing that works for me on Mac is to press the key combination with Option first.在 Mac 上对我有用的一件事是先按下带有 Option 的组合键。

  • So to restart: Opt + R followed by Cmd + R所以要重新启动: Opt + R 后跟 Cmd + R
  • Debug remote JS: Opt + D followed by Cmd + D调试远程 JS:Opt + D 后跟 Cmd + D

Absolutely no idea why it works, but it works for me (MacBook Pro with touchbar, Expo 37 / React Native 61)完全不知道它为什么起作用,但它对我有用(带触摸栏的 MacBook Pro,Expo 37 / React Native 61)

If you are using a custom configuration other than Debug and you're using Cocoapods, make sure the Podfile specifies that that configuration should be a debug configuration.如果您使用的是除Debug之外的自定义配置并且您使用的是 Cocoapods,请确保Podfile指定该配置应该是debug配置。 By default it is assumed to be a release configuration.默认情况下,它被假定为release配置。 Add the following line to the top of your Podfile (assuming your custom configuration is named "Staging"):将以下行添加到Podfile的顶部(假设您的自定义配置名为“Staging”):

For pre-1.0 Cocoapods use xcodeproj :对于 pre-1.0 Cocoapods 使用xcodeproj

xcodeproj 'MyProject', 'Staging' => :debug

For Cocoapods 1.0+ use project :对于 Cocoapods 1.0+ 使用project

project 'MyProject', 'Staging' => :debug

Then, to get the Pods.xcodeproj file to update:然后,要更新Pods.xcodeproj文件:

rm -rf Pods/
pod install

This will ensure the DEBUG=1 Preprocessor Macro is set for the Staging configuration for the Pods project.这将确保为Pods项目的Staging配置设置了DEBUG=1预处理器宏。

I had the same issue with expo + VSCode on windows.我对 windows 上的 expo + VSCode 有同样的问题。

Shaking the device didn't open the developers menu anymore.摇动设备不再打开开发者菜单。

I was able to solve the issue after an hour of frustration by openning "settings.json" file under ".expo" folder in VSCode and add the line "dev": true.经过一个小时的挫折,我能够通过在 VSCode 的“.expo”文件夹下打开“settings.json”文件并添加“dev”行来解决这个问题:true。

For me, I went to the Device in the simulator top menu and clicked shake then it got opened.对我来说,我去了模拟器顶部菜单中的设备并单击shake ,然后它就打开了。 在此处输入图像描述

control + command + z弹出 React Native Debug Menu

I've had a similar issue (however on an Android emulator on a Windows machine, but I'll just post it here if anyone else has that issue).我遇到了类似的问题(但是在 Windows 机器上的 Android 模拟器上,但如果其他人有这个问题,我会在这里发布)。 Basically it happened after enabling/disabling num lock.基本上它发生在启用/禁用数字锁定之后。 Try to toggle your num lock and see if that helps?尝试切换您的数字锁,看看是否有帮助?

for people who have two or more languages in your keyboard, make sure that you're setting the language to English before you hit CMD + D or CMD + R .对于键盘上有两种或多种语言的人,请确保在点击CMD + DCMD + R之前将语言设置为英语

for me, I have Arabic and English languages and I was hitting CMD + ي not CMD + D对我来说,我有ArabicEnglish ,我打的是CMD + ي而不是CMD + D

「Connect Hardware Keyboard」's always not working, either 「连接硬件键盘」也总是不工作

try I/O -> Input -> Send Keyboard Input to Device尝试 I/O -> 输入 -> 将键盘输入发送到设备

⌃ Control + ⌘ Command + Z shakes IOS simulator and opens React Native Debug Menu ⌃ Control + ⌘ Command + Z摇动IOS模拟器并打开React Native Debug Menu

also try this on Simulator menu也可以在模拟器菜单上试试这个

I/O > Keyboard > Connect Hardware Keyboard

我认为Simulator -> Device -> Restart解决了我的问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM