React-native, iOS simulator stops responding to CMD + D - ios

since a couple of months I'm facing a very strange situation, when developing on the latest versions of react native (0.50+ to 0.60+) the iOS simulator stops responding to keyboard commands, that is:
Simulator starts, I can hit Cmd+R or Cmd+D just fine for a few cycles
After some hot reload cycles, the commands completely stop working
If go to Hardware->Keyboard->Send Keyboard Shortcuts and enabled it, the commands start working again
However then the Cmd+Shift+H doesn't work anymore so I cannot easily close the app if I have to
This is really driving me crazy, has anybody faced the same situation or knows any workaround? Many thanks!
P.S. I already tried a few months ago to reset everything (including simulator settings and xcode installation)

I'm having the same issue. Seems to be an iOS 13.3+ simulator issue as you can see in this thread:
iOS Simulator CMD+R CMD+D Shake doesn't work at all after some time
As an alternative, command + ctrl + z still works to access the development menu.

For me pressing "D" then "⌘+D" solves the issue.
The same goes for "R" then "⌘+R".
Not sure if you could actually just press any single key before pressing your desired shortcut.
Kudos to this GitHub answer for helping me out as this was an extremely frustrating issue.
UPDATE:
Since Xcode 12.5 the shortcut for recording the simulator screen is now also CMD+R. This swallows the first CMD+R because instead it starts recording the simulator screen. The next CMD+R will reload the screen. Fortunately, this can be fixed.

I have noticed that pressing R R reloads the app on the latest react-native versions, same as on the android emulator, so maybe this is an intentional change.
For those coming in nowadays
In any case, so far the workarounds seem to be:
cmd + shift + z to trigger the dev menu and then click on reload
r r sometimes also does the trick
d if the simulator is focused

Did you check that you are in Debug Mode and not in Release?
Product > Scheme > Edit Scheme... >
Build Configuration: Debug + check the box Debug executable.
After changing Scheme, better to deinstall your app.
Also I noticed the Cmd D doesn't work during Splashscreen.

Related

React Native IOS simulator Debug menu not opening

This is my first time using react native IOS. I was trying to run my application in ios simulator. But the problem is I need to set debug server host & port for device in dev settings. cmd + d tried but no response debug menu is not opening struck here if anyone has a fix please post here. Its a blocker could not move forward. I am not using useFrameworks. Thanks in advance.
When you are on simulator tab go to I/O menu -> keyboard and check "use hardware keyboard".
This should do the job.
simulator I/O tab
Felix's answer solved my problem, but there are a couple of other things to try.
You can press "d" in the Metro terminal console and it will send a signal to open the menu remotely. (However this doesn't always work either). You'll see:
info Opening developer menu...
I have found CMD-r (reload) starts recording the screenshot in the simulator as that key is already bound, so I experimented and found just pressing "r" works for reload. Then I found just pressing "d" in the focused simulator opens the debug menu.

Simulator in use XCode 7

I have facing this issue frequently, and would like to fix permanently. There are a few known solutions I have like reset the simulator or quitting. But is there a proper fix?
You can run only one application on simulator at one time, So you can used below steps for resolve your problem as:-
A. Quit all other application and run simulator.
Or
B. Quit simulator and re-start application.
Or
C. Reset simulator or derived data based on your requirement.
Simple SoLution My friend
First of all quit your simulator.
And then quit and restart Xcode.
And then run your project.
it will work like Smoothly. try once.. its working 100 %
Then after it does't Work then
Try doing a reset content and settings
Another Way,
If you have two projects open in Xcode and one is running on the simulator, you can't run the other. Go through each project window and see if any are running, and if they are, press the "Stop" button on the top left
Another Way
multiple-projects-using-the-simulator then Here is the p[erfect answer, you can use ot. might be helpful to you.

XCode 6.3.1 - lost connection to attached device frequently

When running my App, I'll get this occur 3 out of 4 attempts to run the app from xcode. Hitting enter & CMD-R will sometimes generate the error again, and sometimes (rarely) actually run & debug the code. This happens with both an iPhone 6 device (8.3) and a iPhone 5 device (8.2).
While it's not a show stopper, its adding to the development cycle time. Anyone out there suffering the same issue, or anyone have a solution?
I've had this happen both with and without a watch extension, but it is more pronounced when working on an App with a watch extension.
While Watch connections can be inconsistent, it seems that keeping the Watch on the charger while debugging is a noticeable improvement. That's been my experience along with others who have comment in the Apple Developer Forums.
So here's my ritual on a "quick" turnaround for build & runs:
Open your app on the Watch
Press and hold the button below the crown until the Power Off options appear
Release the button and press and hold again. This will terminate the running app.
Build & Run from Xcode
On the Debug Navigator it will hang 9/10 times at the "Waiting to Attach" screen
Help Xcode a little bit by tapping on your app icon from your Watch home screen to open it, Xcode will promptly attach.
Your new build is now running.
I really hope they fix this in the next Xcode update but this is how it's currently working for me.

xCode 6 (beta 4) keep getting "The Simulator can't be launched because it is already in use."

I keep getting the "The Simulator can't be launched because it is already in use." when trying to run my app, this only happens about 20% of the time but once so far the only way to get around it is to restart my Mac.
Tried the following but doesn't help:
Cleaning my build folder
Closing and re-opening xCode
Force close of simulator
I'm Using xCode 6 (beta 4)
Any Ideas for a solution that doesn't entail me restarting my Mac?
Thanks
"The Simulator can't be launched because it is already in use.”
This messege will be shown only if there is another xcode project that has launched simulator and hasnt stopped it yet, and u try to run the simulator from another xcode project.
Ideally stopping the simulator from the respective project(PS. not closing the application from the simulator, clicking the STOP button) would do it,
But if it still is working like that, then Closing the simulator, or resetting the simulator contents.
If that still dsnt work, then as a last resort i would ask u to reinstall Xcode, as if this problem keeps going on, then ur downloaded file might be buggy.
P.S if u opt to re-download n install xcode please keep backup.
Hope it solves it. Although i want your problem to be solved by step 2.
This normally just happens when running an app (project) on the simulator and then trying to run another app while the simulator is open (and normally is still within the first app you launched and it can't quit automatically). As long as you keep running the same app you shouldn't get this error and as soon as you run another app just make sure you've closed the simulator before or at least left the previous app with the home button.
Just Restart Your Mac , It Will Fixed
I had the same problem and fixed it without restarting. You just need to reset the content on ios simulator, exit xcode, and then to make sure that you've completely exited, right clicking on the xcode icon on your mac nav bar and click Quit. Open it back up and it should work.

ios Simulator Could Not Find The Application To Simulate

I'm having trouble with the iOS simulator. I'm currently on 10.7 and was using the simulator to test my website. During the testing, I switched the iOS version via the tool bar, and the application froze and quit. Upon restarting, I get the following error message, with a finder window, inviting me to choose an application:
"ios Simulator Could Not Find The Application To Simulate"
Here's what I've tried to fix the issue:
1: Attempt to identify the application it needs, but the only thing i could see to open was a printer app and the ios simulator app, which just results in a "only one iOS simulator can run at a time" error message.
2: Restart the Mac.
3: Download the new Xcode tools from the app store.
4: Restart again.
None of this has helped, and I'm really stuck without it at the moment. If anyone knows how to resolve the problem, I would be grateful to hear any suggestions. Thanks.
Give this a shot.
Open up a new shell, and shoot of this command: sudo <Xcode>/Library/uninstall-devtools --mode=all (assuming thats the location of the instal).
Then run the Xcode installer you got from the app store.
This removes all the plist files that were also installed with xcode, which aren't removed when you simply reinstall. This is as close as you can come to a complete xcode refresh without reinstalling your OS.
Here's an alternative solution that worked for me... the answer selected here did not. I created a blank, "hello world" project and simply ran it. When you run the app, it sends the app to the simulator and voila! iOS Simulator has an app to simulate. From that point forward, you should be able to open the iOS Simulator without a problem.
After a while longer trying various things, it seems like I may have fixed it.
When asking for an application to open, I opened Xcode, and (weirdly) that opened up and left the testing shell visible, with the tool bar intact. I then selected the current version from the device options and hit the home button, and suddenly everything appeared.
Weird thing to have suddenly happened, but there you go.
I still can't test in iOS 3, so that's a bit of a problem, but not a disaster either!

Resources