34 Replies
      Latest reply on Feb 25, 2020 3:23 AM by 68k
      Moog Level 1 Level 1 (0 points)

        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?

        • Re: Copy and Paste Problems
          OOPer Level 8 Level 8 (6,155 points)

          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.

          • Re: Copy and Paste Problems
            Claude31 Level 8 Level 8 (9,215 points)

            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.

            • Re: Copy and Paste Problems
              smartcatPI Level 1 Level 1 (0 points)

              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?

                • Re: Copy and Paste Problems
                  Claude31 Level 8 Level 8 (9,215 points)

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

                    • Re: Copy and Paste Problems
                      Kope8899 Level 1 Level 1 (0 points)

                      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.

                        • Re: Copy and Paste Problems
                          Claude31 Level 8 Level 8 (9,215 points)

                          Did you file a bug report ?

                          • Re: Copy and Paste Problems
                            OOPer Level 8 Level 8 (6,155 points)

                            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.

                              • Re: Copy and Paste Problems
                                smartcatPI Level 1 Level 1 (0 points)

                                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" 
                                error 11:59:23.534333 -0700 pasted [ERROR] Failed to determine whether URL 
                                (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.

                        • Re: Copy and Paste Problems
                          stevenkramer Level 1 Level 1 (0 points)

                          Still seen in 10.1. Very annoying.

                          • Re: Copy and Paste Problems
                            JakubTr Level 1 Level 1 (0 points)

                            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.

                            • Re: Copy and Paste Problems
                              Spartan8 Level 1 Level 1 (0 points)

                              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 !

                                • Re: Copy and Paste Problems
                                  mobileben Level 1 Level 1 (0 points)

                                  Look above, smartcatPI found what looks like the cause. The simulator. It seems that disabling syncing of the pasteboard fixes this.


                                  I should not that this also seems to also affect things outside of Xcode too. I've noticed that my cut and paste is general has had misses.

                                • Re: Copy and Paste Problems
                                  MehulPatel Level 1 Level 1 (0 points)

                                  I am using Xcode Version 10.0 (10A255), for many days I thought my keyboard is not working properly. Todays I struggling a lot, I faced serious copy-paste issues. I used to replace code by pasting over and due to this Xcode issue, I lost my precious business logic.

                                  I would like to say two words to Apple Developer Team, I don't know about you guys but for each developer, "COPY" & "PASTE" are the relics in this programming world, and you guys not even care about it.

                                  I am using Xcode for the last 8 years and from my experiences, the Xcode 4 & 5 were the best. After that, all your improvements won't be helping and adding mess to this beautiful world.


                                  God save us!

                                    • Re: Copy and Paste Problems
                                      MehulPatel Level 1 Level 1 (0 points)

                                      It might possible that this issue can be related to the connection with the device (iPhone, iPad) to the MacBook or iMac.


                                      I used to connect my iPhone with Macbook and using services like (call, text, notes etc) in both, so it's checking the status of the device each time, today I saw the message on iPhone like "Pasting from Macbook". Maybe the issue occurs in this scenario.


                                      Hope this will helps to developer guys to resolve it sooner and provide us with a stable & reliable tool.

                                    • Re: Copy and Paste Problems
                                      mobileben Level 1 Level 1 (0 points)

                                      I also filed another bug report on this.

                                      • Re: Copy and Paste Problems
                                        philzay81 Level 1 Level 1 (0 points)

                                        Just submitted a bug report for this as well. It took me so long to even conceive there could be a bug here cuz I kept thinking to myself surely it must be me, its 2018 there couldn't possibly be a copy/cut/paste bug. Mad kudos to smartcatPI for taking the time to troubleshoot this, you've saved me so much future aggravation. Should also add that re-enabling the "Automatically Sync Pasteboard" feature seems to be safe, its not been long since I toggled it off/on but so far so good.

                                        Update: The bug just reappeared with the same behavior. Thankfully turning off "Automatically Sync Pasteboard" still works to resolve.

                                        • Re: Copy and Paste Problems
                                          alihamadharri Level 1 Level 1 (0 points)

                                          still facing same issue Annoying

                                          • Re: Copy and Paste Problems
                                            daniel.k Level 1 Level 1 (0 points)

                                            Xcode 10.1 / macOS 10.14.1

                                            MacBook Pro (15-inch, 2018)

                                            Serial Number C02X37M8JGH6


                                            Most of the time I have to copy twice to get the data into the clipboard. The most anoying part is when you cut and then it doesn't paste...

                                            • Re: Copy and Paste Problems
                                              VitalyV Level 1 Level 1 (0 points)

                                              Finally, I'm not alone in this problem. I thought it was either my keyboard or MacOS changes.

                                              Thanks guys.

                                              • Re: Copy and Paste Problems
                                                kenanwangyi Level 1 Level 1 (0 points)

                                                I solved this problem in the following way:

                                                Choose Simulator -> Edit -> Uncheck Automatically Sync Pasteboard,

                                                hope to help you!

                                                • Re: Copy and Paste Problems
                                                  NoHopeNoTop Level 1 Level 1 (0 points)

                                                  Still happens on Version 10.3 (10G8)