I\'m working on a basic iOS app which supports both portrait and landscape modes. When the iPhone simulator keyboard is open in landscape and I\'m switching the app
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!?
There is a library for editing plist files called plistlib. Here is my code:
import plistlib
file_name = ('path/to/com.apple.iphonesimulator.plist')
try:
p = plistlib.readPlist(file_name)
p["ConnectHardwareKeyboard"] = "NO"
plistlib.writePlist(p, file_name)
except:
print("Failure")
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.
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.
For me, Select Simulator, Select Hardware -> Keyboard -> Connect hardware Keyboard.
It worked for me.
I just quit my simulator and it worked for me.
Its not a problem just Do these easy steps.
Open Simulator
Going To Top And you See Option Hardware click on this.
When you click on Hardware some option appear and one option is Keyboard.
Click on the Keyboard option and you see three option appear.
If you want to use your mac button keyboard simple select 2nd option Connect Hardware Keyboard.
If your want to use mobile tapping keyboard select 3rd option.
1st option is for those who select their keyboard through code.
Enjoy that all work.