I just tried what you just said and it's true, it doesn't work if I move it to landscape and then to portrait again. It doesn't have any logic because my app is not even changing, and it works fine in the device, so it's a bug in the simulator.
I am seeing the same problem. I believe the issue is related to the command key being "stuck" in the simulator if you rotate the device in the simulator using Command-LeftArrow and Command-RightArrow short cuts.
While we wait for Apple to fix, one way around this is to rotate the device by selecting the menu option instead of the keyboard shortcut. This rotates the device, and seems to leave the keyboard in a working state.
Before you start typing (when the on-screen keyboard shows up), press just the command key by itself and then release it. This should re-enable the keyboard in the simulator.
I have just installed a new version of Xcode (5.0) and the keyboard in iOS Simulator didn't work on first launch. Just restarting the Simulator helped.
I met this problem whenever I rotate the simulator. Following the suggestions to change Hardware options does not work for me, neither reboot iOS Simulator.
I found a trick that click the editing area after rotation makes Mac keyboard end up work.
The solution that really work for me, was deleted the simulator and create new one. This bug I think that commonly occur when all shortcuts does not work from your keyboard to simulator.
For Version 10.0 (SimulatorApp-851.2 CoreSimulator-518.19) with Xcode 9.3, nothing worked for me. I reset the simulator by Hardware -> Erase All Content and Settings -> Erase. Cleaned the project and run on simulator. Keyboard connection is back.
If your Mac keyboard is still disconnected after having all the options and settings correct, one cause is from rotating the device.
If you CMD + ← or → to rotate device early when the simulator is starting up, the Mac keyboard will absolutely not work no matter what; changing menu settings does nothing! It might help to use the Mac keyboard to input inside the device before you rotate device.
Turning off "Send Menu Shortcuts to Device" and restarting the Simulator helps sometimes. I'll update if I get reliable, recreateable behavior.
I find the Mac keyboard works about half the time I run and quit Simulator. 50% ain't bad after all these years!?
For me doing this worked on iPhone 8+ simulator iOS 11.2:
1. Go to Menu -> Hardware -> Erase all contents and settings.
2. Delete derived data from xcode. Xcode -> Preferences -> Locations -> Click on right arrow on left side of "Advanced" button.
This reads the plist file, changes the ConnectHardwareKeyboard value to No and then writes the new file to the same location. This works for me, but let me know if there is a better way to do it. I'm still new at coding.