Copy and Paste Problems

Is it just me or is copy and paste horribly broken in Xcode 9?


About 25% of the time I copy or cut some text in the main editor, when I go to paste, the clipboard's just empty.

I'm pretty sure I'm doing things correctly because, well, it's cut and paste... I've been cutting and pasting in Xcode since Project Builder 1.0.


This has been going on for a few months now and while I'm pulling out what little hair I have left over the issue I'm not reading much about the problem elsewhere.


I filed a bug report about it a few weeks back but haven't heard anything back.


Anyone else encountering this?

Replies

Is it just me or is copy and paste horribly broken in Xcode 9?

I have read many reports of bugs or other weird behaviors of Xcode 9, but it is just you who reported this sort of issue.


You may have installed many apps other than Xcode, any of them might been affecting, have you checked?


Xcode may have many sort of bugs, so this may be another bug of Xcode, just that I did not know.

But you should better consider the cause of this issue might reside in your mac environment.

Hey, I may have observed the same problem. But I always thought I had mistyped the command-C. In XCode 9 or 10.


I'll pay closer attention to it.

I just installed and started using Xcode 10 beta 4 (previously was using just Xcode 9.4.1).

I first noticed the copy bug (copy fails to actually copy, even though the Edit menu blinks as normal when I do a Cmd-C) using Xcode 10 beta 4. But now that I've switched back to Xcode 9.4.1 the bug is still there!


I've even proven the bug with using the Edit menu's Copy command (using my mouse). I cannot reproduce the problem in, say Notes app, nor have I noticed the bug in any other app.


Note: it's not that the copy command is merely skipped. Xcode is clearing the clipboard and then failing to add the new selected text to the clipboard. So that when I go to paste, it beeps at me (and Finder's Show Clipboard says there's nothing on the clipboard, not even what I had previously).


So I think that by installing Xcode 10 beta 4 (I don't know if any previous beta would have this bug or not), now copy is failing for any Xcode I use. Some deeper system of Xcode that all versions share must have been upgraded by installing Xcode 10?


I've done a scan of the Xcode 10 release notes... nothing there about source editor copy bugs or even changes.


I did not touch my Xcode keyboard preferences since installing Xcode 10. I haven't been in that panel in 6+ months. I don't use any Xcode editor extensions. Restarting Xcode does not help at all, even briefly. Restarting the Mac doesn't help either. I've not tried uninstalling Xcode 10 beta 4 and waiting until beta 5 but that'll be my next step. I never run both Xcode apps at once, and I always delete my DerivedData folder before switching between Xcode versions.


My copy command is failing about every 4th try. Incredibly irritating! By the time they fix this, I'll probably be in a habit of doing cmd-C many times in a row for every copy to ensure it works. In fact, I just ran a test: it takes 4 times of pressing cmd-C quickly in a row to reliably make a copy now. i.e. I've sometimes failed at doing 3 in a row, but so far not 4 in a row. 😟


Update: Quitting Xcode (in my case I was running 9.4.1), then throwing Xcode 10 beta 4 into the trash and emptying it, then launching Xcode 9.4.1 again fixed the problem for me in 9.4.1. So I'll put my iOS 12 work on hold until Xcode beta 5. Surely they have a radar on this.


Update 2: Although I still have Xcode 10 beta 4 removed from my system (High Sierra 10.13.5), the bug has come back today in my Xcode 9.4.1, after about an hour of using Xcode. It remains as described above... about every 4th copy fails (failure isn't evident until I try to paste). 😟


Update 3: Upgrading to High Sierra 10.13.6 doesn't help the bug at all. This bug is getting quite irritating. Anyone else have any ideas?

Tested 10 copy and paste in XCode 10 beta4, no issue.

I'm using Xcode 10 beta since the WWDC but I've got this issue only in the past 2 days, so the error is still there, maybe just matter of time and you will get it too.

Did you file a bug report ?

I cannot have experinced the same issue yet. There may be some complex bug in Xcode, as I can see 3 developers reporting the same issue.


I have been using Xcode 10 betas as long as you, but still I have not observed the same issue yet.

The bug may appear only in some specific condition (maybe common to you three who reported).


If you can find the condition, Apple would be able to fix the bug soon.

I've learned something new about this problem. (BTW, the problem also happens with performing a cut).


So the problem was particularly bugging me again this morning as I copied or cut a lot. I was also running Simulator at the time. I fired up Console to see if I could spot a log of the copy error.


error 11:59:23.534222 -0700 pasted [ERROR] Could not create a bookmark: Error 
Domain=NSFileProviderInternalErrorDomain Code=0 "NoValidProviderFound_url" 
UserInfo={NSLocalizedDescription=NoValidProviderFound_url}

error 11:59:23.534333 -0700 pasted [ERROR] Failed to determine whether URL 
/Users/smartcatPI/Library/Developer/CoreSimulator/Devices/D122EBAA-416E-45FA-A58A-2DF36BF0F375/data/Library
/Caches/com.apple.Pasteboard/eb77e5f8f043896faf63b5041f0fbd121db984dd/d287ea0e9a391a97f9d30c695a04309846709917 
(n) is managed by a file provider


So from the above, it appears simply performing a copy in Xcode triggers some kind of access of the pasteboard in the Simulator. Why every 4th copy fails, I still don't know. But when it does, I get the above dumped to my console.


So I simply quit my Simulator and the problem instantly disappeared. Every copy (cmd-C) is now working in Xcode. Xcode is no longer clearing the clipboard rather than copying to it every 4th try.


Hope this helps! I still haven't re-installed Xcode 10 beta 4 yet (since my earlier posting above), but it doesn't surprise me that when I had installed and launched it the first time, it may have done something to affect my existing Xcode 9.x simulators. I'll soon try deleting all my simulators in ~/Library/Developer/CoreSimulator to see if I can get back to a point where I can keep Simulator running on my Mac and still perform an Xcode copy or cut reliably.

That seems to be pointing out the center of the issue. In fact, I was just struggling with the source code editor when I tried copies (or cuts) 'n pastes. I'll try something with simulators later myself, but please share your experience about refreshing your simulators.

I've been facing this issue for a couple of months now, and it has been on both XCode 9.3 and 9.4 for me. I haven't installed XCode 10 yet, so I don't think that is the issue.


After reading smartKatPI's post this morning, I turned off the 'Automatically Sync Pasteboard' option in the Edit menu of the Simulator, and am happy to report that I have been copy and pasting successfully all day!


Thanks for pointing me in the right direction.

Thankyou!

Still seen in 10.1. Very annoying.

For me also, just open Xcode and try to repeat copy and paste three times in a row. In 33% cases it's not working for me, it's horrible. The most using feature for text related applications is not working, for cutting the same picture.

It is definitely broken in Xcode 10.0 again. I have a feeling that this problem occures from time to time in the new Xcode major releases.

Does anybody know the solution ? I have this problem in xCode 10. It is really annoying to make 'cut' or 'copy' and don't have effect. For 'cut' bug happens each time !