可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
This must be documented somewhere, but I can't find it.
In my app using the iPad simulator there is a textfield into which I want the user to paste text. In the real world the user will copy the text from Safari address into the textfield. But I am trying to do that in the ios ipad simulator, but with only partial results.
After I reRUN the app, I can immediately paste text into the textfield with the Mac's Edit|Paste Text
menu or with Shift-Command-V, (but not with just Edit|Paste
, but that's Ok). The need for the Shift is annoying but I can live with it.
But then if I try to copy another URL on the Mac and then again, Edit|Paste Text
or even use the Paste
bubble on the simulator, I don't get the new text, but the original text.
Is that common? Is that a feature of the simulator that it is not connected live to the clipboard on the host computer?
回答1:
Be careful to avoid conflating the mac's clipboard with the simulator's clipboard. They are not the same.
The simulator is simulating an iOS device, with it's own iOS clipboard which apps running on that device (simulator) use via the iOS pup-up select-all/copy/paste UI items.
Completely separate from that: your mac has it's own clipboard and content. The Simulator program running on your mac provides the Edit > Paste Text menu item. The program implements that menu item by accessing your mac clipboard and types the text into the simulator as if the user used the keyboard. The iOS clipboard is neither accessed nor affected by the Simulator application's Edit menu functions.
Update: As of Xcode 6, you need to choose the Edit > Paste
menu item in the iOS Simulator (this transfers the data between the Mac clipboard and the iOS Clipboard), then tap in the field in the simulator and tap the "Paste" bubble.
In your question you don't specify which "Safari" you're copying the URL from. It could be the mac safari application or the simulator's safari app. Doing a copy from the mac safari program goes to the mac clipboard, doing a copy from the safari app goes to the iOS clipboard inside the simulator.
I think your issues are coming from confusing the two, thinking there's one clipboard everything is sharing.
回答2:
Copy text on the mac, then click the text field in the simulator and press
Shift Command V
回答3:
I found that even with Edit > Automatically sync pasteboard ticked, the feature didn't work.
However, simply unticking and then reticking this option fixed the feature!
Hope it works for someone.
回答4:
What worked for me is this.
1) copy text from Mac
2) In simulator do edit->paste or Command V (I think this copies the text from mac clipboard to iOS Simulator clipboard).
3) Highlight the textfield in simulator and then do command + Shift + V.
回答5:
Please click "Automatically sync pasteboard" option in Simulator edit option.
回答6:
I updated to os x 10.13.6 and xcode 10.1 and there is an added menu in edit
click get pasteboard
then you will be able to paste via the paste tooltip in simulator
回答7:
Sometimes it's very difficult to type long URLs in iOS simulator. There should be some way to copy URL from Max OS to iOS text field.
Here's how you can do it:
- Copy some text from Mac
- Open the simulator and click on a text field where you want to paste
the text
- Now in Simulator menu click on
Edit
-> Paste Text
and that's it. Your text from the Mac OS copy buffer should now be there in iOS simulator's text field.
回答8:
Three steps:(The key point is make sure that the "Paste" help menu is keeping visible when you use " ⌘ + V".)
- make sure you select the point you want to past in the simulator, and the editMenu with "Paste" is show.
- use keyboard on mac," ⌘ + V", to paste the text into simulator clipboard.
- click the "Paste" on editMenu that show above, to paste the text into simulator textField.
回答9:
This works for me. On Safari version 8.0.3 and IOs simulator version 8.1
- Copy text from Safari - highlight text then cmd-v or Edit>Copy.
- In Ios Simulator click Edit>Paste.
- On TextField or TextView right click then select Paste.
回答10:
This is what I found.
- Copy text from mac.
- In simulator open safari and highlight the address bar by clicking it.
- Press Cmd + V
- Click once on address bar.
- Paste drop down shall appear.
- Tap on paste.
Shift + Cmd + V works great too.
回答11:
⌘ + V : When iOS simulator is in front,copy the contents of the OS X clipboard over to iOS, but doesn't paste it. Again, this works for both text and images.
So you need to do as follows:
1.copy text anywhere in your macOS except iOS simulator.
2.in iOS simulator, click ⌘ + V, copy text from macOS clipboard to iOS simulator's clipborad.
3.in iOS simulator, TextField or TextView click -> Edit ->Paste.
回答12:
In a new emulator, I got no "paste" option and sync did not work for the simulator.
It appears that in the simulator you MUST copy something to the internal clipboard before the sync actually works.