Katsu
Katsu

Reputation: 8925

Xcode 6: Keyboard does not show up in simulator

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.

Upvotes: 856

Views: 300614

Answers (19)

soundflix
soundflix

Reputation: 2793

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

Upvotes: 4

Muzammil Hasnain
Muzammil Hasnain

Reputation: 149

enter image description here just.
uncheck connect Hardware keyboard

Upvotes: 4

Midhun
Midhun

Reputation: 2197

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

Upvotes: 51

Abhishek Bedi
Abhishek Bedi

Reputation: 5451

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

Upvotes: 1

Faraz Ahmed Khan
Faraz Ahmed Khan

Reputation: 111

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.

Upvotes: 1

ScottyBlades
ScottyBlades

Reputation: 14063

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

Upvotes: 16

Jaywant Khedkar
Jaywant Khedkar

Reputation: 6141

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

Upvotes: 19

Talha Ahmed
Talha Ahmed

Reputation: 158

in viewDidLoad add this line

yourUiTextField.becomeFirstResponder()

Upvotes: 3

Iryna Batvina
Iryna Batvina

Reputation: 1684

Just press ⌘K it will toggle keyboard.

Upvotes: 37

Rachit
Rachit

Reputation: 842

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

Upvotes: 37

iAnkit
iAnkit

Reputation: 1960

To enable/disable simulator keyboard,

⌘ + K (Ctrl + k)

To disable input from your keyboard,

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

Upvotes: 41

aidanmelen
aidanmelen

Reputation: 6614

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.

Upvotes: 439

Jayprakash Dubey
Jayprakash Dubey

Reputation: 36447

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

Upvotes: 61

Syed Sadrul Ullah Sahad
Syed Sadrul Ullah Sahad

Reputation: 1312

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

or Hardware -> Keyboard -> Toggle Software Keyboard

Upvotes: 9

Adeesh Jain
Adeesh Jain

Reputation: 645

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.

Upvotes: 9

saigopi.me
saigopi.me

Reputation: 14938

Simple way is just Press command + k

Upvotes: 1

Kent Ke
Kent Ke

Reputation: 1259

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

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

Upvotes: 104

Joe
Joe

Reputation: 13519

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.

Upvotes: 1351

Martin Velchevski
Martin Velchevski

Reputation: 904

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.

Upvotes: 13

Related Questions