52

I've just updated to Xcode 9.4.1 and experienced an issue with the clipboard being cleared randomly.

So I select a text, hit CMD+C, then go to the position I want to paste it, hit CMD+V, but either

  • it plays the system alert sound and doesn't paste anything, or
  • it pastes a previous snippet that I copied earlier.

Update

Still remains with Xcode 10.1

Update 2

Still remains with Xcode 11

Lukas Würzburger
  • 6,543
  • 7
  • 41
  • 75
  • I've experienced this issue numerous times with older Xcode versions as well. Not sure if it has to do anything with my clipboard manager (I'm using Copied, I used iClipboard before and the same issue occurred to me back then). – Tamás Sengel Jun 14 '18 at 12:30
  • I use Alfred, but never had an issue with that before ... – Lukas Würzburger Jun 14 '18 at 12:39
  • @matt I know that it's a valid workaround, but I'd rather use punch cards than copying and pasting with my mouse (touchpad). I usually just copy the selected part again and it works. – Tamás Sengel Jun 14 '18 at 12:50
  • 1
    @matt Because it happend right after the update of Xcode. So still programming related. Because IDE – Lukas Würzburger Jun 14 '18 at 12:53
  • I've just experienced this exact issue when updating to Xcode 10. I've never experienced it before. I also use Alfred. – cmlloyd Sep 25 '18 at 14:43
  • 1
    I noticed the same problem with the Xcode 10 update. At first I thought it was me that didn't properly copied the text (even though it almost never happened before) but I just cut/paste some text and when I was about to paste it, nothing... I checked and it was properly copied to my clipboard manager. I'm pretty positive it's an Xcode problem. – Nico Sep 26 '18 at 04:45
  • @cmlloyd @Nico If you haven't already, log out and back in. The symptoms sound like ones I've seen when `pboard` has crashed. – Ken Thomases Sep 26 '18 at 08:39
  • @Nico I also confirm that the item has successfully been copied. The strange thing is if if try and paste direct into Xcode (Cmd-V) i get the alert sound and no pasting. However, if i open Alfred clipboard history and paste from the it pastes fine. – cmlloyd Oct 03 '18 at 12:23
  • @KenThomases Logging out didn't appear to make a lot of difference with this issue – cmlloyd Oct 03 '18 at 12:25
  • @KenThomases loging out of? – Nico Oct 03 '18 at 19:11
  • @Nico: Out of your user account on macOS. But cmlloyd reports it didn't help. – Ken Thomases Oct 03 '18 at 20:40
  • I've bought a new keyboard because of that bug – Adam Smaka Jan 30 '19 at 12:27
  • Eva's answer below is the fix! – eric Mar 07 '19 at 20:38

5 Answers5

64

Turning off the 'Automatically Sync Pasteboard' option in the Edit menu of the Simulator works for me. I read it in Apple forums

Eva Madrazo
  • 4,731
  • 2
  • 23
  • 33
  • 2
    Thank yo so very much!! This was driving me bat * crazy! – eric Mar 07 '19 at 20:37
  • 1
    Still happens in Xcode 10.2.1, and this workaround seems to fix it. – noamtm Jun 01 '19 at 19:17
  • In my case this didn't help. I tried several times. Enabling and disabling the sync. As soon as I hit Get Pasteboard from Edit menu, the simulator is frozen and I need to Force Close it. Xcode 10.2.1. iPhone XsMax and others. For me the solution is: Disable Auto Sync + IMPORTANT((SHOW KEYBOARD)). The simulator keyboard should be visible. Then it works as a workaround. – Vito Valov Jun 28 '19 at 16:24
  • @VitoValov I disabled auto sync and show keyboard (no hardware connected) and it still hangs. – CyberMew Sep 04 '19 at 09:52
  • In case instead i'm NOT using simulator - in the Edit menu doesn't exist that options :( So i'm witing each time 1-3 minutes before to having pasted my code in the editor – Simone Campagna Sep 18 '20 at 14:59
8

This really helps! Just uncheck the Automatically Sync Pasteboard

enter image description here

IvanPavliuk
  • 1,460
  • 1
  • 21
  • 16
2

Also read in the Apple forums that closing the simulator while working fixes this issue. So if it happens to me I close the simulator and copy-paste works fine from that point forwards.

Haven't tried it yet but I have feeling that Eva's answer is correct in that the simulator is trying to sync your pasteboard.

Apple forum article

** Edit **

Can confirm that Eva's answer works and I no longer have this issue when I turn of automatic syncing on the simulator

Nick Kirsten
  • 1,187
  • 11
  • 27
2

The accepted answer doesn't work for me. See my comment there. The problem is with the Handoff.

I had the Handoff option enabled in OS X Settings > General.

After unchecking that option, I have the clipboard synced and no simulator freezes.

enter image description here

Vito Valov
  • 1,765
  • 1
  • 19
  • 37
0

You Can try this one:

This is the officially recommended way to reset Xcode's preferences, type in Terminal.app:

defaults delete com.apple.dt.Xcode
Gopal Devra
  • 564
  • 2
  • 5
  • 24