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?
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.
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.
Copy text on the mac, then click the text field in the simulator and press
Shift Command V
Please click "Automatically sync pasteboard" option in Simulator edit option.
Xcode 10.0+:
Turning the Automatic Pasteboard Sync off and then back on again solved the issue.
You might have to do that multiple times. Sometimes it takes a while to trigger it for some reason.
(Edit -> Automatic Pasteboard Sync)
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.
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
Similar thing happened to me and I found a strange workaround, it may help anyone else that may come across the same issue. Try the following steps:
Disable and then re-enable the Automatically Sync Pasteboard option, it's found under the Edit menu on the Simulator
Copy the text you want from your Mac
Paste the text again on your Mac on a text editor like Atom or even your browsers Address Bar
Select all the text Cmd+A and then cut/copy Cmd+X/Cmd+C
You should now be able to paste the text on the simulator
After trying a lot and nothing work on M1 Macs and simulator above 14 I have taken the different route to solve problem.
Apple script to type the text in simulator.
tell application "System Events"
set texttosay to "Sample Text"
display dialog "Text to type:" default answer "white: "
set texttosay to the text returned of the result
repeat
delay 2
repeat 1 times
keystroke texttosay
delay 1
keystroke return
end repeat
exit repeat
end repeat
end tell
Steps:
Run above script in apple scripts and paste the text in dialogue box you want to type in simulator.
click the input-box to populate the value.
Hope that helps in your problem.
Thanks
Nothing from the above solutions worked for me. I am using M1 Apple. The thing that worked was this thread https://github.com/flutter/flutter/issues/74970
In short, if you are using iOS 14.0 to build the app, you will have the above issues.
In order to solve it, what I did was installing iOS 13.7 in xCode by going to
Preferences -> Components -> iOS 13.7 -> then rebuild the app in the xCode.
Just Disable and then re-enable the Automatically Sync Pasteboard option from Edit menu, fixed my problem.
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.
Untick and tick again "Automatically Snyc Pasteboard". Then quit the simulator and re-open it. This is what fixed it for me.
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.
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.
sometimes you just need to select
Hardware -> reset content and settings
in simulator menu.
then all works automatically as easy and transparent as working in MacOS with other applications
Facing the same issue on Apple M2 and Simulator 13.4.1, I was digging into my OS logs and it seems that there are some issues in the Simulator - I guess - since I can read that it is not able to retrieve the content of the pasteboard, stored in a file. I can still open myself the file and confirm the content of the pasteboard is OK.
After request access to the corresponding file while pasting (either using "Paste" menu or classic cmd+V), I can read something like :
Upload preparation for claim XXXX completed with error:
Error Domain=NSCocoaErrorDomain
Code=256 "Impossible d’ouvrir le fichier « bbbb »."
UserInfo={
NSURL=file:///Users/username/Library/Developer/CoreSimulator/Devices/XXXX/data/Library/Caches/com.apple.Pasteboard/ZZZZZ/,
NSFilePath=/Users/username/Library/Developer/CoreSimulator/Devices/XXXX/data/Library/Caches/com.apple.Pasteboard/ZZZZZ/data/Library/Caches/com.apple.Pasteboard/aaaaa/bbbb,
NSUnderlyingError=0x6000005105d0
{Error Domain=NSOSStatusErrorDomain Code=-10817 "(null)"}}
So I guess, Apple has just some adjustments still on-going on the Simulator.
Thus, neither disabling/enabling Auto-sync nor forcing sync of the pasteboard worked in my case.
This is a solution that might work if you are working with React Native.
I ran into this issue now with my M1 Pro Macbook. It started when I updated Xcode to 14.0 before that everything worked fine.
What seems to be the issue is that I'm running terminal in Rosetta. When starting the simulator via npx react-native run-ios this starts the simulator in Rosetta as well (I'm assuming here cannot prove it).
Solution:
Make sure Xcode is running natively and running the project from Xcode instead of Terminal, the Copy-paste functionality should work again.
If you are using Better Touch Tool(BTT), you can create CMD+V action for iOS Simulator and run an apple script that will do the past clipboard
tell application "System Events"
delay 0.1
keystroke (get the clipboard as text)
end tell
I hope it will help somebody.
P.S don't forget to bump the answer if it's helped 👍
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.
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.
⌘ + 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.
None of these solutions worked for me. I'm using Simulator 11.4. And after trying each of these, I realized all I needed to do was copy something on my Mac using Command + C, and then in the simulator text field, simply hold down the mouse click for an extra second or two, and the paste menu popped up automatically, and worked great.
Related
For me and some of my colleges the ability to paste text inside iOS simulator is not working anymore. We are not sure why this happened but some think that once we ran simulator with iOS 16 then the copy/paste functionality stopped working.
It doesn't paste on any app in the simulator nor even on native ios Search bar. I know for at least 3 other colleagues mentioned this started to happen on their system too.
Not even trying to paste with long press option on the textfield, "Paste" option doesn't appear.
This seems a general issue. I was wondering if this is a known bug or if someone found a workaround to make this work again?
Simulator has removed the copy and paste from mac feature. You may not use it anymore.
I am running an iPhone 11 Simulator running iOS 13 and doing some typing simulations via a testing framework.
After finishing typing I would like to delete the keyboard dictionary (ie. wipe the new words that the keyboard learned as I typed).
Resetting the keyboard dictionary is possible on a real device by going to "Settings" -> "General" > "Reset" -> tap "Reset Keyboard Dictionary", but this option seems to be missing on the simulator.
Does anyone know why this option is missing on the emulator and how to (if possible) bring it up?
I believe that whilst the simulator is the main window, you can select Harware->Erase All Content and Settings... and this will delete the keyboard dictionary, along with many other settings/preferences.
Not really an answer but a workaround to your question but if you can't find any other solution you can reset the whole device (it's like a factory reset) from menu Hardware -> Erase All Content and Settings or from command line using xcrun simctl erase booted
Just updated to Xcode 6, midway through working on a project. Now the only destination that comes up is my own iPhone, which is annoying as I would rather prefer a simulator.
I've already tried messing with the schemes as suggested by other answers and restarted my computer, any ideas?
First, you have to download other iOS versions as owenfi suggested, however that is not all.
If you want the simulators to show up in the scheme menu/popup, then you also have to open Devices menu (Cmd + Shift + 2 or Window/Devices) and add the required simulators. You can choose between all devices and the iOS versions you've downloaded. Have a look on the screenshot below.
Download support for additional simulators in Xcode Preferences > Downloads.
I never understood but after some installation they don't show up. One easy way is create them in the devices window. Open xcode go into Window then devices, press the plus button at the bottom left and create yours.
Changing Deployment Target worked for me..
I have successfully created a Custom Keyboard with Swift on iOS 8 simulator.
Although it worked well, but I could not debug it. It is a contained target and was installed through Settings->General. Placing a bookmark in XCode not work.
I am able to debug a custom keyboard using the simulator via Xcode 6.
Select the keyboard (and not it's container) as the scheme.
"Run" and then select on of the apps on your simulator to debug the extension with.
It seems as of now apple didn't get support for debugging extension into simulator. I was having same issue but I observe that We can debug code if we execute application into device as below.
1) Choose your Keyboard extension target.
2) Go to Edit Scheme.
3) In info tab select your Executable from drop down and check the option "Debug extensions and XPC services".
Still several problems are there like we can't see output of NSLog but you can check the value of variables same as before or I suggest you to check this link It may work for displaying NSLog output KeyboardViewController NSLog IOS 8.
Apple has reported this problem as a know issue in Xcode 6.1 release notes:
Localization and Keyboard settings, including 3rd party keyboards, are not correctly honored by Safari, Maps, and developer apps in the iOS 8.1 Simulator. [NSLocale currentLocale] returns en_US and only the English and Emoji keyboards are available. (18418630, 18512161)
I'm using Xcode 6.1.1 and seems that it still hasn't been solved but I've discovered a workaround. You should follow this steps:
Open Xcode and in its menu bar click into Xcode > Open Developer Tool > iOS Simulator
Now into iOS Simulator menu bar go to Hardware > keyboard and check if "Connect Hardware Keyboard" is enable. If it is, click it to disable and quit iOS Simulator
Then go back to Xcode and make sure that keyboard is selected as scheme
Click into run button or press Product > Run to build and run you application and in the "Choose an app to run" menu choose Today
When iOS Simulator starts, go to Settings > General > Keyboard > Keyboards > Add New Keyboard and select your own and then press in your keyboard command + shift + H to back to the homescreen
Finally open Calendar app and press the magnifying glass icon, the keyboard will appear and you only need to hold the globe button to show the list of enabled keyboards and select yours
Note that it's important to try your keyboard in the Calendar app because in most applications it doesn't work or it has an unexpected behavior
If the keyboard still doesn't appear:
remove the file com.apple.iphonesimulator.plist from ~/Libray/Preferences/
In iOS Simulator menu bar click into iOS Simulator > Reset Content and Settings...
More info about keyboard debugging and development here
After searching and investigating this, I've found the best solution to be to install and use Reveal. It helps you visualise the custom keyboard like the debug hierarchy view and shows various other measures.
So I'm still reasonably new to iOS development and I'm finding myself quite regularly needing to delete either DerivedData, or the contents of the iPhone Simulator directory, to get things to actually execute from my code. Clean in Xcode doesn't do the same as emptying those directories, right? And if not, is there an easier way to do it than lugging Finder around to get to them, and clearing them?
66:99 and climbing:
Yes, there is a better way than going into every single simulator in town, and resetting contents and settings one at a time. Also much better than looking into your simulator's directory and yanking the cache from under its feet.
Quit iPhone Simulator, then run xcrun in Terminal:
xcrun simctl erase all
Safe and effective.
See https://stackoverflow.com/a/26394597/218152 for single device
xcrun simctl erase [device ID]
In the iOS Simulator menu, there is an option called Reset Content and Settings...
This should do the trick.
EDIT:
To make this much quicker and easier, I added a shortcut key like this...
In System Preferences, choose Keyboard
Then choose the Shortcuts tab.
And click App Shortcuts
Click the plus button to add another shortcut.
Lastly:
Click theChoose Simulator from the Application: drop-down. If it's not there, scroll to the bottom of the application list and choose "Other...". Then type "simulator" into the search and add the Simulator from there.
Type Erase All Content and Settings... into the Menu Title: text-box.
Type your preferred shortcut key into the Keyboard Shortcut:. (I use command-period)
Click the Add button.
Now, while in your iOS Simulator, you can simply use your new shortcut key to reset.
If the Simulator doesn't appear in the drop down list:
In a Finder window, go to your Applications folder.
Right-click Xcode and choose "Show Package Contents".
Navigate to
Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/
You will see iPhone Simulator.app.
Now, in the Settings app, instead of choosing iOS Simulator which is missing, you choose Other....
This will cause a window to appear that has a list of Applications.
Now, drag iPhone Simulator.app from your Finder window to the window that appeared when you clicked Other....
For web development and testing on the iOS Simulator (Safari):
With both iOS Simulator and Safari open, go to Safari > Develop > iOS Simulator and select your page which will give you access to the Web Inspector tools.
Go to Safari > Develop > Empty Caches to clear the cache on iOS Safari.
Web inspector new has option to disable cache 2020 solution