How do I type using my keyboard on the iphone simulator?

后端 未结 12 737
太阳男子
太阳男子 2020-12-22 17:21

I used to be able to type with my real mac keyboard after launching the iPhone Simulator. Typing with the on-screen simulator keyboard is just horrible when testing with lar

相关标签:
12条回答
  • 2020-12-22 17:43

    Try trashing the iPhone Simulator preferences file. When my iPhone Simulator stopped responding to keystrokes, this fixed it.

    1. Quit the simulator.
    2. Go to finder and press (command+shift+G) then navigate ~/Library/Preferences.
    3. Move com.apple.iphonesimulator.plist to the trash.
    4. Try launching your iPhone app in the simulator again.
    0 讨论(0)
  • 2020-12-22 17:47

    Shell / Command-Line / Jenkins / CI:

    sh "plutil -replace DevicePreferences.${deviceID}.ConnectHardwareKeyboard -bool NO $HOME/Library/Preferences/com.apple.iphonesimulator.plist"
    sh "plutil -extract DevicePreferences.${deviceID} xml1 -o - $HOME/Library/Preferences/com.apple.iphonesimulator.plist"
    

    The Device ID can be found via xcrun / simctl, based on the devoce name:

    xcrun simctl list | grep ${simulatorDeviceName} | sed 's/).*(.*//;s/.*(//'
    
    0 讨论(0)
  • 2020-12-22 17:47

    I encountered the same problem and tried a lot of different ways which worked mostly but never for sure. Ultimately, I found this. https://stackoverflow.com/a/26057011/1463604

    0 讨论(0)
  • 2020-12-22 17:48

    Just restart Simulator (close and open the app).

    0 讨论(0)
  • 2020-12-22 17:50

    Don't trash the iPhone simulator preference files. There's no need to do this.

    Look in the simulator's menu Hardware ➔ Keyboard. The menu options are:

    1. iOS Uses Same Layout as OS X
    2. Connect Hardware Keyboard ⇧⌘K
    3. Toggle Software Keyboard ⌘K

    Ensure option 2 is checked.

    If it's already checked, uncheck it then check it again (you'll probably want to learn the keyboard shortcuts).

    If you find that this hides the on screen keyboard, but you also want this to show, use option 3 to toggle it back on.

    If rotating the simulator seems to stop the keyboard working, toggle option two off then back on – this seems to resolve it.

    0 讨论(0)
  • 2020-12-22 17:52

    If you are developing a React Native app and you cannot refresh (⌘R) or enable remote debugging (⌘D) from the iOS simulator, while other keyboard inputs work, make sure you are running a debug build configuration. You can check this with:

    Product -> Scheme -> Edit Scheme -> Run -> Info -> Build Configuration -> Debug"

    I got this tip from here.

    0 讨论(0)
提交回复
热议问题