821

The keyboard does not show up when I run the simulator and click in the UITextView. How do I re-enable the keyboard?

It used to work but now it doesn't - I don't know what I might have clicked by accident.

Stephen Ostermiller
  • 23,933
  • 14
  • 88
  • 109
Katsu
  • 8,479
  • 3
  • 15
  • 16

19 Answers19

1320

I had the same issue. My solution was as follows:

  1. iOS Simulator -> Hardware -> Keyboard
  2. Uncheck "Connect Hardware Keyboard"

Mine was checked because I was using my mac keyboard, but if you make sure it is unchecked the iPhone keyboard will always come up.

dwitvliet
  • 7,242
  • 7
  • 36
  • 62
Joe
  • 13,209
  • 1
  • 10
  • 4
  • 7
    Ironically they keyboard is there, if you change screen orientation you can see it hidden off-screen in the bottom corner as the frame adjusts size and reveals it for a split second... so when Apple has hardware keyboard enabled they actually just slide the keyboard just off-screen so that it's invisible. Interesting, I suppose they do this so that a `UIInputAccessoryView` still displays at the bottom of the screen. – Albert Renshaw Jul 30 '14 at 15:22
  • 5
    @AlbertRenshaw They keyboard is always there. any ios. It is just under the view bounds. You can play around with the views and you will find it there! The slide up animation is just pulling it up :) – João Nunes Aug 15 '14 at 12:02
  • @JoãoNunes You would think Apple would remove it from superview for RAM's sake. – Albert Renshaw Aug 15 '14 at 14:15
  • 1
    I would think this would be considered a bug in the Xcode 6 iOS Simulator; for me `Connect Hardware Keyboard` was checked by default. – pkamb Aug 20 '14 at 16:49
  • 8
    Actually, this is *really* a bug: when I uncheck `Connect Hardware Keyboard` I can't type using my Mac's keyboard. In pre-iOS 8 it didn't "simulate a hardware keyboard", it just allowed you to additionally type using your Mac. – pkamb Aug 20 '14 at 17:03
  • 3
    @AlbertRenshaw somewhere in iOS6 docs (referring why DidUnload was removed) apple mention that a UIView structure doesn't take that much memory. Also having the keyboard in RAM is not an issue. You will use it over and over again. It is a speed gain, which is more important than a RAM gain! – João Nunes Aug 24 '14 at 14:48
  • 1
    So from now on we can only use either real or sim keyboard but not both?? – Stas Oct 15 '14 at 16:10
  • 3
    To fix this issue AND still be able to type with your real keyboard, see the [answer by Aidan Melen](http://stackoverflow.com/a/25053454/159758) – DonnaLea Mar 09 '15 at 08:30
416

While testing in the ios8 beta simulator, you may toggle between the "software keyboard" and "hardware keyboard" with +K.

UPDATE: Since iOS Simulator 8.0, the shortcut is ++K.

L Y E S - C H I O U K H
  • 4,765
  • 8
  • 40
  • 57
aidanmelen
  • 6,194
  • 1
  • 23
  • 24
  • 9
    actually your answer is great, and the only reason it doesn't show is because it's set to soft keyboard, and cmd+K will toggle the keyboard.. this answers the question, and it's great.. i wish i can give you +1000 – Nour Helmi Aug 13 '14 at 14:43
  • 3
    OMG, I just spent an hour on this thinking that becomeFirstResponder wasn't working! – SmileBot Sep 19 '14 at 19:30
  • 8
    **⌘⇧K** In Simulator v8.0(550.1) – beryllium Sep 25 '14 at 18:50
  • 2
    this worked for me...but I don't remember when did I press ⌘K to disable the simulator keyboard.... – iphondroid Sep 30 '14 at 13:55
  • That's Golden! I hit the keystroke by mistake! And hmm! Have two simulator work in one and not the other! i'm glade i googled so quickly! After thinking a bit about it! Thanks! Gold – Mohamed Allal Aug 05 '21 at 21:44
102

Simulator -> Hardware -> Keyboard -> Toggle Software Keyboard should solve this problem.

Simulator->Hardware->Keyboard->Toggle Software Keyboard

Kent Ke
  • 1,239
  • 1
  • 8
  • 6
60

This seems to be a bug in iOS 8. There are two fixes to this problem :

  1. Toggle between simulator keyboard and MacBook keyboard using the Command+K shortcut.

  2. Reattach keyboard to simulator :

    a. Open Simulator

    b. Select Hardware -> Keyboard

    c. Uncheck and then check 'Connect Hardware Keyboard'

Screenshot for step 2

OR simply press the Shift + Command + K shortcut

L Y E S - C H I O U K H
  • 4,765
  • 8
  • 40
  • 57
Jayprakash Dubey
  • 35,723
  • 18
  • 170
  • 177
  • I agree that this seems to be a bug, at least as of Xcode 8.3.3. After I call endEditing, the keyboard **intermittently** ceases to appear _even after I pop the view controller and reload it_. Once I noticed that the behavior was intermittent, it became pretty clear that it's not something my code is doing (which is the case 99% of the time--most of the time when I think it's Xcode's fault, it's usually something I'm doing!). In this case I'm pretty certain this is an Xcode bug. – James Toomey Jul 15 '17 at 14:38
47

To enable/disable simulator keyboard: click ⇧+⌘+K to show the keyboard on simulator, click again to disable (hide) the keyboard.

++K

OR

enter image description here

Simulator ->I/O ->Keyboard ->Toggle Software Keyboard

midhun p
  • 1,987
  • 18
  • 24
41

To enable/disable simulator keyboard,

⌘ + K (Ctrl + k)

To disable input from your keyboard,

iOS Simulator -> Hardware -> Keyboard -> Uncheck "Connect Hardware Keyboard"

iAnkit
  • 1,940
  • 19
  • 25
37

You can use : ++K to show keyboard on simulator.

byJeevan
  • 3,728
  • 3
  • 37
  • 60
Rachit
  • 814
  • 9
  • 19
35

Just press ⌘K it will toggle keyboard.

Iryna Batvina
  • 1,656
  • 13
  • 7
18

In the new simulator Hardware option is removed,

If you want to find a Keyboard option manually, Then click on the I/O section,

I/O -> Keyboard ->Toggle Software Keyboard(⌘K)

enter image description here

Dharman
  • 30,962
  • 25
  • 85
  • 135
Jaywant Khedkar
  • 5,941
  • 2
  • 44
  • 55
14

This worked for me. Click I/O, then Keyboard. When the "Connect Hardware Keyboard" is deselected, then the simulator keyboard will popup.
enter image description here

ScottyBlades
  • 12,189
  • 5
  • 77
  • 85
13

It would be difficult to say if there's any issue with your code without checking it out, however this happens to me quite a lot in (Version 6.0 (6A216f)). I usually have to reset the simulator's Content and Settings and/or restart xCode to get it working again. Try those and see if that solves the problem.

Martin Velchevski
  • 874
  • 11
  • 33
9

To fix the problem follow this -

  1. Quit Xcode and simulator
  2. Press ‘command+shift+g’ .. it will open the “go to folder” dialog.
  3. type “~/Library/Preferences” in this dialog to go to your preference folder.
  4. Delete “com.apple.iphonesimulator.plist” in this folder
  5. Done. “com.apple.iphonesimulator.plist” will be regenerated when you start simulator again.

Alternatively you can also do this with just one command.

Open terminal and fire - 1. rm ~/Library/Preferences/com.apple.iphonesimulator.plist

This will do the trick in one step! Just make sure you quit Xcode and simulator before running this.

Adeesh Jain
  • 645
  • 10
  • 22
8

If keyboard do not shown up automatically in simulator, just press [Command+K]

or Hardware -> Keyboard -> Toggle Software Keyboard

3

in viewDidLoad add this line

yourUiTextField.becomeFirstResponder()
Talha Ahmed
  • 160
  • 1
  • 10
1

Simple way is just Press command + k

saigopi.me
  • 14,011
  • 2
  • 83
  • 54
1

If the simulator's keyboard doesn't open by pressing ⌘K, reset the simulator to factory settings. go to Simulator's menu Device -> Erase all Contents and Settings.. It will resolve the keyboard not opening issue.

1

Using Script You can run via Xcode Pre Run Action

/usr/libexec/PlistBuddy -c "Print :DevicePreferences" 
~/Library/Preferences/com.apple.iphonesimulator.plist | perl -lne 'print 
$1 if /^    (\S*) =/' | while read -r a; do /usr/libexec/PlistBuddy -c 
"Set :DevicePreferences:$a:ConnectHardwareKeyboard false" 
~/Library/Preferences/com.apple.iphonesimulator.plist || /usr/libexec/PlistBuddy -c  "Add :DevicePreferences:$a:ConnectHardwareKeyboard bool false" ~/Library/Preferences/com.apple.iphonesimulator.plist; done

enter image description here

Abhishek Bedi
  • 5,205
  • 2
  • 36
  • 62
1

enter image description here just.
uncheck connect Hardware keyboard

0

DISCLAIMER: This is a very old question, but since other questions on this subject are getting closed as duplicates of this one, I thought it could benefit from an answer that puts all the updated options in one. Thanks to all who have contributed in answering!


If the iOS Keyboard ("Software Keyboard") does not show up while a text entry field (UITextField/TextField etc.) is focused, the cause are most probably the settings in Simulator.

There are 2 settings in Simulator menu:

  • I/O > Keyboard > Connect Hardware Keyboard ⇧⌘K

  • I/O > Keyboard > Toggle Software Keyboard ⌘K

enter image description here

Pre-XCode 8, the "I/O" menu was called "Hardware"

As you can see, each setting has their own keyboard shortcut. The first one controls if you can use your macOS keyboard for those field. The second controls the show/hide state of the iOS keyboard. If Hardware Keyboard is connected, Software Keyboard will be pushed out of view.

You don't have to Connect/Disconnect Hardware Keyboard each time you want to use it. Instead, keep it connected and whenever you need to use it, just type along (Software Keyboard will disappear), then push ⌘K to make Software Keyboard appear to judge your layout.


Additionally, in some edge cases where changing the 2 settings does not help, you may need to use:

  • Simulator menu Device > Erase all Contents and Settings ...
soundflix
  • 928
  • 9
  • 22