Mac 키보드를 사용하여 iPhone 시뮬레이터에서 텍스트 필드를 입력 할 수 없습니까?
저는 세로 및 가로 모드를 모두 지원하는 기본 iOS 앱을 개발 중 입니다. iPhone 시뮬레이터 키보드가 가로 모드로 열려 있고 앱을 세로 모드로 전환 할 때 Mac 물리적 키보드를 사용하여 텍스트 필드에 아무것도 입력 할 수 없습니다.
전에 경험 한 사람이 있습니까? 알려진 버그입니까?
나를 위해 일한 훌륭한 솔루션을 찾았습니다.
시뮬레이터를 열고 메뉴 하드웨어-> 키보드에는 세 가지 옵션이 있습니다.
- iOS는 OS X와 동일한 레이아웃을 사용합니다.이 옵션은 Mac 키보드를 비활성화합니다.
- 하드웨어 키보드 연결 :이 옵션은 Mac 키보드를 활성화하지만 키보드는 표시되지 않습니다.
- 소프트웨어 키보드 토글 :이 옵션을 사용하면 Mac 키패드를 사용하여 입력 할 수 있으며 화면 키보드에도 iOS가 표시됩니다.
Xcode 9에서는 iPhone 8+ 시뮬레이터에서 동일한 문제에 직면했습니다. 이 방법으로 해결할 수있었습니다.
~/Library/Preferences/com.apple.iphonesimulator.plist
파일 열기- 문제가있는 시뮬레이터 식별자 찾기 ( 장치 및 시뮬레이터 창에 표시됨)
- 설정
CaptureKeyboardInput
에 대한 값YES
- 시뮬레이터 다시 시작
입력을 시작하기 전에 (화상 키보드가 나타날 때) command 키만 누른 다음 놓습니다. 시뮬레이터에서 키보드를 다시 활성화해야합니다.
시뮬레이터 메뉴에서 >> 하드웨어 >> 키보드 >> 하드웨어 키보드 연결
또는
그냥 눌러 ⌘ + ⌂ + K
iOS 시뮬레이터를 시작하고 Hardware > Keyboard > Connect Hardware Keyboard
.
(You might have accidentally disabled it by pressing CMD + SHIFT + K
- same shortcut as Clean in Xcode)
On the Simulator try to change the device. Then run your app again on the original device. That worked for me.
If the first step alone doesn't work uncheck the option: iOS Uses same keyboard layout as OS X and then change the device.
I figured it out doing random stuff until it worked. Monkey fixing.
None of these suggestions worked for me. I closed the iOS Simulator app and restarted it. That fixed it for me.
I am seeing the same problem. I believe the issue is related to the command key being "stuck" in the simulator if you rotate the device in the simulator using Command-LeftArrow and Command-RightArrow short cuts.
While we wait for Apple to fix, one way around this is to rotate the device by selecting the menu option instead of the keyboard shortcut. This rotates the device, and seems to leave the keyboard in a working state.
Repeating below command twice worked for me!!
CMD+Shift+K
Its not a problem just Do these easy steps.
Open Simulator
Going To Top And you See Option Hardware click on this.
When you click on Hardware some option appear and one option is Keyboard.
Click on the Keyboard option and you see three option appear.
If you want to use your mac button keyboard simple select 2nd option Connect Hardware Keyboard.
If your want to use mobile tapping keyboard select 3rd option.
1st option is for those who select their keyboard through code.
Enjoy that all work.
I have just installed a new version of Xcode (5.0) and the keyboard in iOS Simulator didn't work on first launch. Just restarting the Simulator helped.
i think it is only because of a problem that you did not selected 'connect hardware keyboard option, on the simulator menu bar named 'Hardware'
Please follow the steps
Goto : Hardware -> Keyboard -> Connect Hardware Keyboard
Hope it will help you with the problem , Thank you.
For me, Select Simulator, Select Hardware -> Keyboard -> Connect hardware Keyboard.
It worked for me.
I just tried what you just said and it's true, it doesn't work if I move it to landscape and then to portrait again. It doesn't have any logic because my app is not even changing, and it works fine in the device, so it's a bug in the simulator.
You can report it to Apple using this:
https://developer.apple.com/bug-reporting/
The solution that really work for me, was deleted the simulator and create new one. This bug I think that commonly occur when all shortcuts does not work from your keyboard to simulator.
I had problem with iPhone6 simulator i changed it to iPhone7.On iPhone7 i am able to continue my work.
If your Mac keyboard is still disconnected after having all the options and settings correct, one cause is from rotating the device.
If you CMD + ← or → to rotate device early when the simulator is starting up, the Mac keyboard will absolutely not work no matter what; changing menu settings does nothing! It might help to use the Mac keyboard to input inside the device before you rotate device.
Turning off "Send Menu Shortcuts to Device" and restarting the Simulator helps sometimes. I'll update if I get reliable, recreateable behavior.
I find the Mac keyboard works about half the time I run and quit Simulator. 50% ain't bad after all these years!?
Quit simulator and run following command in terminal:
rm ~/Library/Preferences/com.apple.iphonesimulator.plist
I met this problem whenever I rotate the simulator. Following the suggestions to change Hardware options does not work for me, neither reboot iOS Simulator.
I found a trick that click the editing area after rotation makes Mac keyboard end up work.
After doing so many stuffs, just a restart of my machine and enabling the below worked.
Enabling this in simulator: Hardware -> Keyboard -> Connect Hardware Keyboard
For Version 10.0 (SimulatorApp-851.2 CoreSimulator-518.19) with Xcode 9.3, nothing worked for me. I reset the simulator by Hardware -> Erase All Content and Settings -> Erase. Cleaned the project and run on simulator. Keyboard connection is back.
I ran into this problem after I removed Main.storyboard
and created the main window in code. Reverting back to using Main.storyboard
fixed it for me.
For me doing this worked on iPhone 8+ simulator iOS 11.2: 1. Go to Menu -> Hardware -> Erase all contents and settings. 2. Delete derived data from xcode. Xcode -> Preferences -> Locations -> Click on right arrow on left side of "Advanced" button.
I just restart the simulator and It worked for me.
Just use CMD+SHIFT+K and the keyboard will activate on it's own.
for me, on simulator opened, in the menu of your mac, click Hardware and reach to keyboard option and select toggle software keyboard.as shown
There is a library for editing plist files called plistlib. Here is my code:
import plistlib
file_name = ('path/to/com.apple.iphonesimulator.plist')
try:
p = plistlib.readPlist(file_name)
p["ConnectHardwareKeyboard"] = "NO"
plistlib.writePlist(p, file_name)
except:
print("Failure")
This reads the plist file, changes the ConnectHardwareKeyboard
value to No
and then writes the new file to the same location. This works for me, but let me know if there is a better way to do it. I'm still new at coding.
'developer tip' 카테고리의 다른 글
탐색 창에서 선택한 메뉴 항목의 색상 변경 (0) | 2020.08.29 |
---|---|
두 CGRect 비교 (0) | 2020.08.29 |
하위보기가보기에 있는지 확인 (0) | 2020.08.29 |
Android에서 프로그래밍 방식으로 ImageView의 이미지 변경 (0) | 2020.08.29 |
Android 스튜디오-android-18 대상을 찾지 못했습니다. (0) | 2020.08.28 |