ChatGPT解决这个技术问题 Extra ChatGPT

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.

Just press ⌘K it will toggle keyboard.
You must have accidentally disabled it when you are trying to "clean" your code. :)
That's right, this issue appeared after I cleaned my Terminal window :) Thanks a lot for the tip!
Xcode 8 => ⌘+Shift+K

d
dwitvliet

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

iOS Simulator -> Hardware -> Keyboard 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.


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
L
L Y E S - C H I O U K H

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.


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 helped a lot. Thanks
K
Kent Ke

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

https://i.stack.imgur.com/mJcDq.png


Simple and best answer..+1
Your answer save me :) Vote +
L
L Y E S - C H I O U K H

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

Toggle between simulator keyboard and MacBook keyboard using the Command+K shortcut. Reattach keyboard to simulator : a. Open Simulator b. Select Hardware -> Keyboard c. Uncheck and then check 'Connect Hardware Keyboard'

https://i.stack.imgur.com/AU9Qd.png

OR simply press the Shift + Command + K shortcut


@Tommy : Welcome...buddy!
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.
i
iAnkit

To enable/disable simulator keyboard,

⌘ + K (Ctrl + k)

To disable input from your keyboard,

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


b
byJeevan

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


I
Iryna Batvina

Just press ⌘K it will toggle keyboard.


m
midhun p

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

⇧+⌘+K


M
Martin Velchevski

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.


D
Dharman

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)

https://i.stack.imgur.com/RRfuH.jpg


S
ScottyBlades

https://i.stack.imgur.com/mVzvC.png


A
Adeesh Jain

To fix the problem follow this -

Quit Xcode and simulator Press ‘command+shift+g’ .. it will open the “go to folder” dialog. type “~/Library/Preferences” in this dialog to go to your preference folder. Delete “com.apple.iphonesimulator.plist” in this folder 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.


Thanks. Toggling Software Keyboard did not work for me. This one did!
Great answer. + ten billion.
S
Syed Sadrul Ullah Sahad

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

or Hardware -> Keyboard -> Toggle Software Keyboard


T
Talha Ahmed

in viewDidLoad add this line

yourUiTextField.becomeFirstResponder()

s
saigopi.me

Simple way is just Press command + k