870

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.

5
  • 220
    Just press ⌘K it will toggle keyboard. Commented Feb 12, 2015 at 13:08
  • 3
    You must have accidentally disabled it when you are trying to "clean" your code. :) Commented Dec 21, 2015 at 8:20
  • 1
    stackoverflow.com/help/someone-answers Commented Oct 12, 2016 at 13:16
  • 2
    That's right, this issue appeared after I cleaned my Terminal window :) Thanks a lot for the tip! Commented Aug 17, 2017 at 0:55
  • 14
    Xcode 8 => ⌘+Shift+K Commented Nov 22, 2018 at 7:30

19 Answers 19

1364

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.

Sign up to request clarification or add additional context in comments.

10 Comments

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.
@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 :)
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.
@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!
To fix this issue AND still be able to type with your real keyboard, see the answer by Aidan Melen
|
447

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.

5 Comments

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
OMG, I just spent an hour on this thinking that becomeFirstResponder wasn't working!
⌘⇧K In Simulator v8.0(550.1)
this worked for me...but I don't remember when did I press ⌘K to disable the simulator keyboard....
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
104

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

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

Comments

61

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

1 Comment

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.
51

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

1 Comment

This is the answer if your Mac is M2 above, like mine. Tks man!!!
41

To enable/disable simulator keyboard,

⌘ + K (Ctrl + k)

To disable input from your keyboard,

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

Comments

37

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

Comments

37

Just press ⌘K it will toggle keyboard.

Comments

19

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

Comments

16

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

1 Comment

How can we do this via script?
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.

Comments

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.

2 Comments

Thanks. Toggling Software Keyboard did not work for me. This one did!
Great answer. + ten billion.
9

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

or Hardware -> Keyboard -> Toggle Software Keyboard

Comments

5

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 ...

Comments

4

enter image description here just.
uncheck connect Hardware keyboard

1 Comment

I really like when someone just provides solution.
3

in viewDidLoad add this line

yourUiTextField.becomeFirstResponder()

Comments

1

Simple way is just Press command + k

Comments

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.

Comments

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.