Xcode 9: Could not attach to pid












44














I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.



It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).




Could not attach to pid : “2370”

Ensure <project title> is not already running, and <system username> has permission to debug it.




Here is a snapshot for the same issue:



error message - Could not attach to pid



What would be permanent solution of this issue, as it's disturbing frequently?










share|improve this question
























  • Can you file a bug on this and attach the output of sudo sysdiagnose -q and xcrun simctl diagnose?
    – russbishop
    Jun 28 '17 at 6:50










  • @russbishop Reported a bug. Command 'xcrun simctl diagnose' not working. Error: Unrecognized subcommand: diagnose
    – Krunal
    Jun 28 '17 at 9:45










  • you must have an older version of Xcode selected with xcode-select. Make sure Xcode 9 is selected.
    – russbishop
    Jul 3 '17 at 5:01










  • I cleaned the derived data & cleaned the build folder. It worked for me.
    – iOSDev
    Oct 5 '17 at 2:23










  • @russbishop i am also having in 9.4 when i am running test cases how will solve it please help
    – ChitaRanjan Sahu
    Sep 26 '18 at 9:52
















44














I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.



It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).




Could not attach to pid : “2370”

Ensure <project title> is not already running, and <system username> has permission to debug it.




Here is a snapshot for the same issue:



error message - Could not attach to pid



What would be permanent solution of this issue, as it's disturbing frequently?










share|improve this question
























  • Can you file a bug on this and attach the output of sudo sysdiagnose -q and xcrun simctl diagnose?
    – russbishop
    Jun 28 '17 at 6:50










  • @russbishop Reported a bug. Command 'xcrun simctl diagnose' not working. Error: Unrecognized subcommand: diagnose
    – Krunal
    Jun 28 '17 at 9:45










  • you must have an older version of Xcode selected with xcode-select. Make sure Xcode 9 is selected.
    – russbishop
    Jul 3 '17 at 5:01










  • I cleaned the derived data & cleaned the build folder. It worked for me.
    – iOSDev
    Oct 5 '17 at 2:23










  • @russbishop i am also having in 9.4 when i am running test cases how will solve it please help
    – ChitaRanjan Sahu
    Sep 26 '18 at 9:52














44












44








44


9





I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.



It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).




Could not attach to pid : “2370”

Ensure <project title> is not already running, and <system username> has permission to debug it.




Here is a snapshot for the same issue:



error message - Could not attach to pid



What would be permanent solution of this issue, as it's disturbing frequently?










share|improve this question















I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.



It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).




Could not attach to pid : “2370”

Ensure <project title> is not already running, and <system username> has permission to debug it.




Here is a snapshot for the same issue:



error message - Could not attach to pid



What would be permanent solution of this issue, as it's disturbing frequently?







ios xcode debugging swift4 xcode9






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 8 '18 at 3:25

























asked Jun 20 '17 at 10:50









Krunal

37.8k20138163




37.8k20138163












  • Can you file a bug on this and attach the output of sudo sysdiagnose -q and xcrun simctl diagnose?
    – russbishop
    Jun 28 '17 at 6:50










  • @russbishop Reported a bug. Command 'xcrun simctl diagnose' not working. Error: Unrecognized subcommand: diagnose
    – Krunal
    Jun 28 '17 at 9:45










  • you must have an older version of Xcode selected with xcode-select. Make sure Xcode 9 is selected.
    – russbishop
    Jul 3 '17 at 5:01










  • I cleaned the derived data & cleaned the build folder. It worked for me.
    – iOSDev
    Oct 5 '17 at 2:23










  • @russbishop i am also having in 9.4 when i am running test cases how will solve it please help
    – ChitaRanjan Sahu
    Sep 26 '18 at 9:52


















  • Can you file a bug on this and attach the output of sudo sysdiagnose -q and xcrun simctl diagnose?
    – russbishop
    Jun 28 '17 at 6:50










  • @russbishop Reported a bug. Command 'xcrun simctl diagnose' not working. Error: Unrecognized subcommand: diagnose
    – Krunal
    Jun 28 '17 at 9:45










  • you must have an older version of Xcode selected with xcode-select. Make sure Xcode 9 is selected.
    – russbishop
    Jul 3 '17 at 5:01










  • I cleaned the derived data & cleaned the build folder. It worked for me.
    – iOSDev
    Oct 5 '17 at 2:23










  • @russbishop i am also having in 9.4 when i am running test cases how will solve it please help
    – ChitaRanjan Sahu
    Sep 26 '18 at 9:52
















Can you file a bug on this and attach the output of sudo sysdiagnose -q and xcrun simctl diagnose?
– russbishop
Jun 28 '17 at 6:50




Can you file a bug on this and attach the output of sudo sysdiagnose -q and xcrun simctl diagnose?
– russbishop
Jun 28 '17 at 6:50












@russbishop Reported a bug. Command 'xcrun simctl diagnose' not working. Error: Unrecognized subcommand: diagnose
– Krunal
Jun 28 '17 at 9:45




@russbishop Reported a bug. Command 'xcrun simctl diagnose' not working. Error: Unrecognized subcommand: diagnose
– Krunal
Jun 28 '17 at 9:45












you must have an older version of Xcode selected with xcode-select. Make sure Xcode 9 is selected.
– russbishop
Jul 3 '17 at 5:01




you must have an older version of Xcode selected with xcode-select. Make sure Xcode 9 is selected.
– russbishop
Jul 3 '17 at 5:01












I cleaned the derived data & cleaned the build folder. It worked for me.
– iOSDev
Oct 5 '17 at 2:23




I cleaned the derived data & cleaned the build folder. It worked for me.
– iOSDev
Oct 5 '17 at 2:23












@russbishop i am also having in 9.4 when i am running test cases how will solve it please help
– ChitaRanjan Sahu
Sep 26 '18 at 9:52




@russbishop i am also having in 9.4 when i am running test cases how will solve it please help
– ChitaRanjan Sahu
Sep 26 '18 at 9:52












13 Answers
13






active

oldest

votes


















23














If issue is on OS Mojave and you are trying like me to run tests on older Xcode version, make sure that in your scheme, when you select Test, Debug executable is disabled



enter image description here



You won't be able to debug tests from this point






share|improve this answer























  • It worked for me, thx!
    – diegomen
    Oct 22 '18 at 9:00










  • It did the trick for me too! Thanks!
    – sebleclerc
    Oct 24 '18 at 3:05






  • 1




    That works, but then you can't debug your tests anymore :(
    – Ben Marten
    Oct 25 '18 at 21:49










  • Unbelievable! Thank you!
    – Camilo Aguilar
    Dec 14 '18 at 0:21



















15














Still not a permanent solution, but I had to quit and restart XCode as the other solutions did not work for me.






share|improve this answer





























    7














    This worked for me:



    Edit Scheme -> Info -> Executable -> Ask on launch



    Credits to @nastya-gorban's answer here



    Update



    After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".



    Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.



    If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:




    We suggest that you use automatic signing for your debug builds and
    manual signing for your distribution builds.







    share|improve this answer























    • I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
      – Efren
      Jul 24 '18 at 4:28










    • According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
      – Efren
      Jul 27 '18 at 7:25










    • Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
      – Efren
      Sep 4 '18 at 8:22



















    6














    I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)



    It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.



    After removing the beta, it worked with the stable version.






    share|improve this answer

















    • 3




      This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
      – jowie
      Sep 28 '18 at 15:03



















    5














    Killing my simulator and then running it again from Xcode.






    share|improve this answer





















    • I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
      – Krunal
      Oct 17 '17 at 9:37



















    4














    delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that






    share|improve this answer





















    • I tried that solution, but it solves error temporary. Can i have its permanent solution.
      – Krunal
      Oct 16 '17 at 16:54



















    3














    I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.



    I am using:
    - Xcode v9.2
    - Swift 3.2
    - Building for iOS



    The things that I tried that DID NOT WORK were:



    restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.



    What WORKED was as @Rajasekhar mentioned:




    • checked out the Keychain certificates.

    • deleted the exiting ones by right clicking (they'd passed expiration)

    • and unchecked "automatically manage signing" in Targets->General


    After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.






    share|improve this answer

















    • 1




      Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
      – Gilles Gouaillardet
      Feb 2 '18 at 4:12






    • 1




      i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
      – tameikal
      Feb 3 '18 at 4:52





















    2














    This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.






    share|improve this answer

















    • 1




      Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
      – Krunal
      Oct 6 '17 at 14:19








    • 1




      No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
      – Tamás Sengel
      Oct 6 '17 at 14:21






    • 2




      Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
      – Krunal
      Oct 7 '17 at 2:42












    • Exact!, for me that is due to an excessive time waiting for emulator response
      – Josem
      Jun 26 '18 at 12:44



















    2














    I too faced the same issue, I was trying to run the test cases with older version of xcode (9.4 in my case).



    Disabling Debug Executable worked.
    enter image description here






    share|improve this answer





























      1














      This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.






      share|improve this answer





















      • How can I remove certificate, can you please eleborate in detail?
        – Krunal
        Oct 26 '17 at 4:02










      • open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
        – Rajasekhar Pasupuleti
        Oct 26 '17 at 5:02










      • One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
        – Rajasekhar Pasupuleti
        Oct 28 '17 at 10:36










      • We can achieve it by re-starting device & Xcode once.
        – Rajasekhar Pasupuleti
        Dec 11 '17 at 19:08










      • None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
        – n8tr
        Dec 21 '17 at 23:04



















      1














      I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.



      Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.



      What worked was to run Xcode (9.4) with sudo,



      sudo /Applications/Xcode.app/Contents/MacOS/Xcode


      I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.



      The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,



      error: attach failed: unable to attach





      share|improve this answer























      • This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
        – jowie
        Sep 28 '18 at 15:04



















      0














      (most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings



      (less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)






      share|improve this answer





























        0














        This happens on my machine, when I set the 'new build system'
        Go to menu file=>workspace settings and set Build System to "Standard".






        share|improve this answer





















          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44651029%2fxcode-9-could-not-attach-to-pid%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          13 Answers
          13






          active

          oldest

          votes








          13 Answers
          13






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          23














          If issue is on OS Mojave and you are trying like me to run tests on older Xcode version, make sure that in your scheme, when you select Test, Debug executable is disabled



          enter image description here



          You won't be able to debug tests from this point






          share|improve this answer























          • It worked for me, thx!
            – diegomen
            Oct 22 '18 at 9:00










          • It did the trick for me too! Thanks!
            – sebleclerc
            Oct 24 '18 at 3:05






          • 1




            That works, but then you can't debug your tests anymore :(
            – Ben Marten
            Oct 25 '18 at 21:49










          • Unbelievable! Thank you!
            – Camilo Aguilar
            Dec 14 '18 at 0:21
















          23














          If issue is on OS Mojave and you are trying like me to run tests on older Xcode version, make sure that in your scheme, when you select Test, Debug executable is disabled



          enter image description here



          You won't be able to debug tests from this point






          share|improve this answer























          • It worked for me, thx!
            – diegomen
            Oct 22 '18 at 9:00










          • It did the trick for me too! Thanks!
            – sebleclerc
            Oct 24 '18 at 3:05






          • 1




            That works, but then you can't debug your tests anymore :(
            – Ben Marten
            Oct 25 '18 at 21:49










          • Unbelievable! Thank you!
            – Camilo Aguilar
            Dec 14 '18 at 0:21














          23












          23








          23






          If issue is on OS Mojave and you are trying like me to run tests on older Xcode version, make sure that in your scheme, when you select Test, Debug executable is disabled



          enter image description here



          You won't be able to debug tests from this point






          share|improve this answer














          If issue is on OS Mojave and you are trying like me to run tests on older Xcode version, make sure that in your scheme, when you select Test, Debug executable is disabled



          enter image description here



          You won't be able to debug tests from this point







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 14 '18 at 19:19

























          answered Oct 17 '18 at 13:11









          ninja_iOS

          7581920




          7581920












          • It worked for me, thx!
            – diegomen
            Oct 22 '18 at 9:00










          • It did the trick for me too! Thanks!
            – sebleclerc
            Oct 24 '18 at 3:05






          • 1




            That works, but then you can't debug your tests anymore :(
            – Ben Marten
            Oct 25 '18 at 21:49










          • Unbelievable! Thank you!
            – Camilo Aguilar
            Dec 14 '18 at 0:21


















          • It worked for me, thx!
            – diegomen
            Oct 22 '18 at 9:00










          • It did the trick for me too! Thanks!
            – sebleclerc
            Oct 24 '18 at 3:05






          • 1




            That works, but then you can't debug your tests anymore :(
            – Ben Marten
            Oct 25 '18 at 21:49










          • Unbelievable! Thank you!
            – Camilo Aguilar
            Dec 14 '18 at 0:21
















          It worked for me, thx!
          – diegomen
          Oct 22 '18 at 9:00




          It worked for me, thx!
          – diegomen
          Oct 22 '18 at 9:00












          It did the trick for me too! Thanks!
          – sebleclerc
          Oct 24 '18 at 3:05




          It did the trick for me too! Thanks!
          – sebleclerc
          Oct 24 '18 at 3:05




          1




          1




          That works, but then you can't debug your tests anymore :(
          – Ben Marten
          Oct 25 '18 at 21:49




          That works, but then you can't debug your tests anymore :(
          – Ben Marten
          Oct 25 '18 at 21:49












          Unbelievable! Thank you!
          – Camilo Aguilar
          Dec 14 '18 at 0:21




          Unbelievable! Thank you!
          – Camilo Aguilar
          Dec 14 '18 at 0:21













          15














          Still not a permanent solution, but I had to quit and restart XCode as the other solutions did not work for me.






          share|improve this answer


























            15














            Still not a permanent solution, but I had to quit and restart XCode as the other solutions did not work for me.






            share|improve this answer
























              15












              15








              15






              Still not a permanent solution, but I had to quit and restart XCode as the other solutions did not work for me.






              share|improve this answer












              Still not a permanent solution, but I had to quit and restart XCode as the other solutions did not work for me.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Nov 17 '17 at 18:46









              PicklesIIDX

              15913




              15913























                  7














                  This worked for me:



                  Edit Scheme -> Info -> Executable -> Ask on launch



                  Credits to @nastya-gorban's answer here



                  Update



                  After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".



                  Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.



                  If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:




                  We suggest that you use automatic signing for your debug builds and
                  manual signing for your distribution builds.







                  share|improve this answer























                  • I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
                    – Efren
                    Jul 24 '18 at 4:28










                  • According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
                    – Efren
                    Jul 27 '18 at 7:25










                  • Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
                    – Efren
                    Sep 4 '18 at 8:22
















                  7














                  This worked for me:



                  Edit Scheme -> Info -> Executable -> Ask on launch



                  Credits to @nastya-gorban's answer here



                  Update



                  After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".



                  Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.



                  If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:




                  We suggest that you use automatic signing for your debug builds and
                  manual signing for your distribution builds.







                  share|improve this answer























                  • I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
                    – Efren
                    Jul 24 '18 at 4:28










                  • According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
                    – Efren
                    Jul 27 '18 at 7:25










                  • Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
                    – Efren
                    Sep 4 '18 at 8:22














                  7












                  7








                  7






                  This worked for me:



                  Edit Scheme -> Info -> Executable -> Ask on launch



                  Credits to @nastya-gorban's answer here



                  Update



                  After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".



                  Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.



                  If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:




                  We suggest that you use automatic signing for your debug builds and
                  manual signing for your distribution builds.







                  share|improve this answer














                  This worked for me:



                  Edit Scheme -> Info -> Executable -> Ask on launch



                  Credits to @nastya-gorban's answer here



                  Update



                  After spending a considerable time with examples on Apple bug report, they basically disregarded the issue as using manual certificates is not "expected".



                  Long story short, if you don't have a business account and hence multiple developers on the same account, you should be fine with using the automatic signing and should not see the issue.



                  If you do have a business account with multiple users (which I found it breaks automatic signing), this is their suggestion:




                  We suggest that you use automatic signing for your debug builds and
                  manual signing for your distribution builds.








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Sep 4 '18 at 8:26

























                  answered Jun 20 '18 at 5:33









                  Efren

                  1,07311239




                  1,07311239












                  • I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
                    – Efren
                    Jul 24 '18 at 4:28










                  • According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
                    – Efren
                    Jul 27 '18 at 7:25










                  • Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
                    – Efren
                    Sep 4 '18 at 8:22


















                  • I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
                    – Efren
                    Jul 24 '18 at 4:28










                  • According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
                    – Efren
                    Jul 27 '18 at 7:25










                  • Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
                    – Efren
                    Sep 4 '18 at 8:22
















                  I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
                  – Efren
                  Jul 24 '18 at 4:28




                  I have since posted the issue on the Bug reporter, but still interchanging info to figure the cause.
                  – Efren
                  Jul 24 '18 at 4:28












                  According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
                  – Efren
                  Jul 27 '18 at 7:25




                  According to apple: "You can’t debug something provisioned with an ad-hoc distribution profile. Distribution profiles don’t allow debugging...We assume you’re using manual signing. If you selected a distribution signing certificate, then you can’t choose a development provisioning profile. Development provisioning profiles don’t contain distribution signing certificates. So, if you want to debug, you’ll need to select a development signing certificate and a development provisioning profile. Incidentally, this is what automatic signing would have done for you without all the fuss."
                  – Efren
                  Jul 27 '18 at 7:25












                  Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
                  – Efren
                  Sep 4 '18 at 8:22




                  Latest and final reply: "Engineering has determined that this issue behaves as intended based on the following information: Yep, depending on which OS we're talking about, the rules are stronger for debugging a process. Ask On Launch is also potentially finding a different copy of the application, so, even on newer iOS versions there may be a way to get something running via "Ask on Launch" if it gets the distribution signed copy. We suggest that you use automatic signing for your debug builds and manual signing for your distribution builds."
                  – Efren
                  Sep 4 '18 at 8:22











                  6














                  I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)



                  It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.



                  After removing the beta, it worked with the stable version.






                  share|improve this answer

















                  • 3




                    This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
                    – jowie
                    Sep 28 '18 at 15:03
















                  6














                  I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)



                  It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.



                  After removing the beta, it worked with the stable version.






                  share|improve this answer

















                  • 3




                    This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
                    – jowie
                    Sep 28 '18 at 15:03














                  6












                  6








                  6






                  I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)



                  It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.



                  After removing the beta, it worked with the stable version.






                  share|improve this answer












                  I had this issue too. There seems to be an issue with having two Xcode version installed at the same time. (9.4.1 and 10.0 Beta)



                  It works with the beta, but not with the stable version. Everything is set to the tools of the Xcode 9.4.1 stable version. I can only run my unit tests with the beta.



                  After removing the beta, it worked with the stable version.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jul 2 '18 at 12:49









                  Maik639

                  9951335




                  9951335








                  • 3




                    This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
                    – jowie
                    Sep 28 '18 at 15:03














                  • 3




                    This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
                    – jowie
                    Sep 28 '18 at 15:03








                  3




                  3




                  This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
                  – jowie
                  Sep 28 '18 at 15:03




                  This sounds like my issue. I installed Xcode 10 and updated to Mojave. Then I had to use Xcode 9.4 again and it started complaining like this. I will try uninstalling Xcode 10 and see if that helps.
                  – jowie
                  Sep 28 '18 at 15:03











                  5














                  Killing my simulator and then running it again from Xcode.






                  share|improve this answer





















                  • I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
                    – Krunal
                    Oct 17 '17 at 9:37
















                  5














                  Killing my simulator and then running it again from Xcode.






                  share|improve this answer





















                  • I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
                    – Krunal
                    Oct 17 '17 at 9:37














                  5












                  5








                  5






                  Killing my simulator and then running it again from Xcode.






                  share|improve this answer












                  Killing my simulator and then running it again from Xcode.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 17 '17 at 9:36









                  user2421755

                  5111




                  5111












                  • I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
                    – Krunal
                    Oct 17 '17 at 9:37


















                  • I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
                    – Krunal
                    Oct 17 '17 at 9:37
















                  I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
                  – Krunal
                  Oct 17 '17 at 9:37




                  I tried all these solutions, but it solves error temporary. Can i have its permanent solution?
                  – Krunal
                  Oct 17 '17 at 9:37











                  4














                  delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that






                  share|improve this answer





















                  • I tried that solution, but it solves error temporary. Can i have its permanent solution.
                    – Krunal
                    Oct 16 '17 at 16:54
















                  4














                  delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that






                  share|improve this answer





















                  • I tried that solution, but it solves error temporary. Can i have its permanent solution.
                    – Krunal
                    Oct 16 '17 at 16:54














                  4












                  4








                  4






                  delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that






                  share|improve this answer












                  delete derived data and clean the project, wait until processing is complete, this may take some time. The idea is to give some processing time. Works fine after that







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 16 '17 at 16:03









                  Divya

                  413




                  413












                  • I tried that solution, but it solves error temporary. Can i have its permanent solution.
                    – Krunal
                    Oct 16 '17 at 16:54


















                  • I tried that solution, but it solves error temporary. Can i have its permanent solution.
                    – Krunal
                    Oct 16 '17 at 16:54
















                  I tried that solution, but it solves error temporary. Can i have its permanent solution.
                  – Krunal
                  Oct 16 '17 at 16:54




                  I tried that solution, but it solves error temporary. Can i have its permanent solution.
                  – Krunal
                  Oct 16 '17 at 16:54











                  3














                  I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.



                  I am using:
                  - Xcode v9.2
                  - Swift 3.2
                  - Building for iOS



                  The things that I tried that DID NOT WORK were:



                  restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.



                  What WORKED was as @Rajasekhar mentioned:




                  • checked out the Keychain certificates.

                  • deleted the exiting ones by right clicking (they'd passed expiration)

                  • and unchecked "automatically manage signing" in Targets->General


                  After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.






                  share|improve this answer

















                  • 1




                    Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
                    – Gilles Gouaillardet
                    Feb 2 '18 at 4:12






                  • 1




                    i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
                    – tameikal
                    Feb 3 '18 at 4:52


















                  3














                  I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.



                  I am using:
                  - Xcode v9.2
                  - Swift 3.2
                  - Building for iOS



                  The things that I tried that DID NOT WORK were:



                  restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.



                  What WORKED was as @Rajasekhar mentioned:




                  • checked out the Keychain certificates.

                  • deleted the exiting ones by right clicking (they'd passed expiration)

                  • and unchecked "automatically manage signing" in Targets->General


                  After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.






                  share|improve this answer

















                  • 1




                    Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
                    – Gilles Gouaillardet
                    Feb 2 '18 at 4:12






                  • 1




                    i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
                    – tameikal
                    Feb 3 '18 at 4:52
















                  3












                  3








                  3






                  I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.



                  I am using:
                  - Xcode v9.2
                  - Swift 3.2
                  - Building for iOS



                  The things that I tried that DID NOT WORK were:



                  restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.



                  What WORKED was as @Rajasekhar mentioned:




                  • checked out the Keychain certificates.

                  • deleted the exiting ones by right clicking (they'd passed expiration)

                  • and unchecked "automatically manage signing" in Targets->General


                  After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.






                  share|improve this answer












                  I have been dealing with this issue for days. I have been able to build but not launch on Simulator, and I get the same "pid:.." error message.



                  I am using:
                  - Xcode v9.2
                  - Swift 3.2
                  - Building for iOS



                  The things that I tried that DID NOT WORK were:



                  restarting the computer; deleting content and settings (of Simulator, I do not have "reset"); uninstalling and reinstalling Xcode; changing "Deployment Target"; changing the device in the simulator's Hardware->Manage Device; deleting Derived Data, Cleaning and Building, or just waiting...forever.



                  What WORKED was as @Rajasekhar mentioned:




                  • checked out the Keychain certificates.

                  • deleted the exiting ones by right clicking (they'd passed expiration)

                  • and unchecked "automatically manage signing" in Targets->General


                  After that it successfully launched in Simulator. I don't know if the issue will come back but hopefully this works.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Feb 1 '18 at 19:52









                  tameikal

                  766




                  766








                  • 1




                    Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
                    – Gilles Gouaillardet
                    Feb 2 '18 at 4:12






                  • 1




                    i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
                    – tameikal
                    Feb 3 '18 at 4:52
















                  • 1




                    Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
                    – Gilles Gouaillardet
                    Feb 2 '18 at 4:12






                  • 1




                    i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
                    – tameikal
                    Feb 3 '18 at 4:52










                  1




                  1




                  Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
                  – Gilles Gouaillardet
                  Feb 2 '18 at 4:12




                  Please don't add "thank you" as an answer. Once you have sufficient reputation, you will be able to vote up questions and answers that you found helpful. - From Review
                  – Gilles Gouaillardet
                  Feb 2 '18 at 4:12




                  1




                  1




                  i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
                  – tameikal
                  Feb 3 '18 at 4:52






                  i included an extra step that i took as well as how to delete the certificate which was not mentioned above but was asked by another user
                  – tameikal
                  Feb 3 '18 at 4:52













                  2














                  This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.






                  share|improve this answer

















                  • 1




                    Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
                    – Krunal
                    Oct 6 '17 at 14:19








                  • 1




                    No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
                    – Tamás Sengel
                    Oct 6 '17 at 14:21






                  • 2




                    Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
                    – Krunal
                    Oct 7 '17 at 2:42












                  • Exact!, for me that is due to an excessive time waiting for emulator response
                    – Josem
                    Jun 26 '18 at 12:44
















                  2














                  This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.






                  share|improve this answer

















                  • 1




                    Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
                    – Krunal
                    Oct 6 '17 at 14:19








                  • 1




                    No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
                    – Tamás Sengel
                    Oct 6 '17 at 14:21






                  • 2




                    Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
                    – Krunal
                    Oct 7 '17 at 2:42












                  • Exact!, for me that is due to an excessive time waiting for emulator response
                    – Josem
                    Jun 26 '18 at 12:44














                  2












                  2








                  2






                  This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.






                  share|improve this answer












                  This seems to be a temporary issue when you are trying to build too fast after a build has started. Try stopping and running the project again.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Oct 6 '17 at 14:19









                  Tamás Sengel

                  26.5k146793




                  26.5k146793








                  • 1




                    Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
                    – Krunal
                    Oct 6 '17 at 14:19








                  • 1




                    No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
                    – Tamás Sengel
                    Oct 6 '17 at 14:21






                  • 2




                    Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
                    – Krunal
                    Oct 7 '17 at 2:42












                  • Exact!, for me that is due to an excessive time waiting for emulator response
                    – Josem
                    Jun 26 '18 at 12:44














                  • 1




                    Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
                    – Krunal
                    Oct 6 '17 at 14:19








                  • 1




                    No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
                    – Tamás Sengel
                    Oct 6 '17 at 14:21






                  • 2




                    Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
                    – Krunal
                    Oct 7 '17 at 2:42












                  • Exact!, for me that is due to an excessive time waiting for emulator response
                    – Josem
                    Jun 26 '18 at 12:44








                  1




                  1




                  Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
                  – Krunal
                  Oct 6 '17 at 14:19






                  Yes, it is temporary. But facing often, with different PIDs> There isn't permanent solution to it? It works fine, "Stopping and running again". But not gone forever.
                  – Krunal
                  Oct 6 '17 at 14:19






                  1




                  1




                  No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
                  – Tamás Sengel
                  Oct 6 '17 at 14:21




                  No, not yet. Seems like it's a bug. Try running only once and don't click several times on the button.
                  – Tamás Sengel
                  Oct 6 '17 at 14:21




                  2




                  2




                  Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
                  – Krunal
                  Oct 7 '17 at 2:42






                  Yes, I raised a ticket in Bug Reporter for the same. But Apple is unable to track a bug. I shared a complete system report generated using command xcrun simctl diagnose and forwarded to Apple.
                  – Krunal
                  Oct 7 '17 at 2:42














                  Exact!, for me that is due to an excessive time waiting for emulator response
                  – Josem
                  Jun 26 '18 at 12:44




                  Exact!, for me that is due to an excessive time waiting for emulator response
                  – Josem
                  Jun 26 '18 at 12:44











                  2














                  I too faced the same issue, I was trying to run the test cases with older version of xcode (9.4 in my case).



                  Disabling Debug Executable worked.
                  enter image description here






                  share|improve this answer


























                    2














                    I too faced the same issue, I was trying to run the test cases with older version of xcode (9.4 in my case).



                    Disabling Debug Executable worked.
                    enter image description here






                    share|improve this answer
























                      2












                      2








                      2






                      I too faced the same issue, I was trying to run the test cases with older version of xcode (9.4 in my case).



                      Disabling Debug Executable worked.
                      enter image description here






                      share|improve this answer












                      I too faced the same issue, I was trying to run the test cases with older version of xcode (9.4 in my case).



                      Disabling Debug Executable worked.
                      enter image description here







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Oct 30 '18 at 11:35









                      Saif

                      1,2231923




                      1,2231923























                          1














                          This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.






                          share|improve this answer





















                          • How can I remove certificate, can you please eleborate in detail?
                            – Krunal
                            Oct 26 '17 at 4:02










                          • open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
                            – Rajasekhar Pasupuleti
                            Oct 26 '17 at 5:02










                          • One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
                            – Rajasekhar Pasupuleti
                            Oct 28 '17 at 10:36










                          • We can achieve it by re-starting device & Xcode once.
                            – Rajasekhar Pasupuleti
                            Dec 11 '17 at 19:08










                          • None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
                            – n8tr
                            Dec 21 '17 at 23:04
















                          1














                          This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.






                          share|improve this answer





















                          • How can I remove certificate, can you please eleborate in detail?
                            – Krunal
                            Oct 26 '17 at 4:02










                          • open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
                            – Rajasekhar Pasupuleti
                            Oct 26 '17 at 5:02










                          • One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
                            – Rajasekhar Pasupuleti
                            Oct 28 '17 at 10:36










                          • We can achieve it by re-starting device & Xcode once.
                            – Rajasekhar Pasupuleti
                            Dec 11 '17 at 19:08










                          • None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
                            – n8tr
                            Dec 21 '17 at 23:04














                          1












                          1








                          1






                          This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.






                          share|improve this answer












                          This is the issue with the untrusted certificates in key-chain access, please remove such a type of certificates and re-build again.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Oct 26 '17 at 1:41









                          Rajasekhar Pasupuleti

                          815612




                          815612












                          • How can I remove certificate, can you please eleborate in detail?
                            – Krunal
                            Oct 26 '17 at 4:02










                          • open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
                            – Rajasekhar Pasupuleti
                            Oct 26 '17 at 5:02










                          • One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
                            – Rajasekhar Pasupuleti
                            Oct 28 '17 at 10:36










                          • We can achieve it by re-starting device & Xcode once.
                            – Rajasekhar Pasupuleti
                            Dec 11 '17 at 19:08










                          • None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
                            – n8tr
                            Dec 21 '17 at 23:04


















                          • How can I remove certificate, can you please eleborate in detail?
                            – Krunal
                            Oct 26 '17 at 4:02










                          • open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
                            – Rajasekhar Pasupuleti
                            Oct 26 '17 at 5:02










                          • One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
                            – Rajasekhar Pasupuleti
                            Oct 28 '17 at 10:36










                          • We can achieve it by re-starting device & Xcode once.
                            – Rajasekhar Pasupuleti
                            Dec 11 '17 at 19:08










                          • None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
                            – n8tr
                            Dec 21 '17 at 23:04
















                          How can I remove certificate, can you please eleborate in detail?
                          – Krunal
                          Oct 26 '17 at 4:02




                          How can I remove certificate, can you please eleborate in detail?
                          – Krunal
                          Oct 26 '17 at 4:02












                          open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
                          – Rajasekhar Pasupuleti
                          Oct 26 '17 at 5:02




                          open key-chain access -> check for the certificates, there you can find certificates those not related with your protect. (typically what I'm trying to tell you is? 'some times you open unknown certificates into your key chain access, those are related with your project only but currently do don't have any membership on those teams')
                          – Rajasekhar Pasupuleti
                          Oct 26 '17 at 5:02












                          One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
                          – Rajasekhar Pasupuleti
                          Oct 28 '17 at 10:36




                          One more suggestion is Just kill the Xcode and Simulator, turn-Off your device and restart again,I believe this will fix the issue.
                          – Rajasekhar Pasupuleti
                          Oct 28 '17 at 10:36












                          We can achieve it by re-starting device & Xcode once.
                          – Rajasekhar Pasupuleti
                          Dec 11 '17 at 19:08




                          We can achieve it by re-starting device & Xcode once.
                          – Rajasekhar Pasupuleti
                          Dec 11 '17 at 19:08












                          None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
                          – n8tr
                          Dec 21 '17 at 23:04




                          None of the solutions posted here are working at all for me. I've even restarted my computer several times. I can currently only run on a real device. Any updates?
                          – n8tr
                          Dec 21 '17 at 23:04











                          1














                          I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.



                          Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.



                          What worked was to run Xcode (9.4) with sudo,



                          sudo /Applications/Xcode.app/Contents/MacOS/Xcode


                          I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.



                          The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,



                          error: attach failed: unable to attach





                          share|improve this answer























                          • This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
                            – jowie
                            Sep 28 '18 at 15:04
















                          1














                          I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.



                          Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.



                          What worked was to run Xcode (9.4) with sudo,



                          sudo /Applications/Xcode.app/Contents/MacOS/Xcode


                          I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.



                          The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,



                          error: attach failed: unable to attach





                          share|improve this answer























                          • This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
                            – jowie
                            Sep 28 '18 at 15:04














                          1












                          1








                          1






                          I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.



                          Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.



                          What worked was to run Xcode (9.4) with sudo,



                          sudo /Applications/Xcode.app/Contents/MacOS/Xcode


                          I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.



                          The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,



                          error: attach failed: unable to attach





                          share|improve this answer














                          I hate to add more noise to this, but for me, the answer is to, nonsensically, use sudo.



                          Run normally, Xcode 9.4.1 (9F2000) and Xcode 10.0 beta 4 (10L213o) both failed to attach to my app after multiple tries, giving the error quoted in the original post.



                          What worked was to run Xcode (9.4) with sudo,



                          sudo /Applications/Xcode.app/Contents/MacOS/Xcode


                          I don't see why sudo is necessary. The Cocoa app to which I am attaching is a Debug build that I just built in Xcode 9.4.1 and dragged into /Applications. It is not codesigned. Posix permissions on the .app, its Contents, its MacOS, and the executable are all octal 755. Owner is me. It works fine if I leave it in the Build folder, build and debug in the normal way.



                          The problem is apparently with lldb. I also tried using lldb (lldb-902.0.79.7) from the command line. I got the same result. It works only with sudo. Without sudo,



                          error: attach failed: unable to attach






                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Aug 14 '18 at 15:31









                          Krunal

                          37.8k20138163




                          37.8k20138163










                          answered Aug 14 '18 at 14:53









                          Jerry Krinock

                          1,5871420




                          1,5871420












                          • This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
                            – jowie
                            Sep 28 '18 at 15:04


















                          • This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
                            – jowie
                            Sep 28 '18 at 15:04
















                          This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
                          – jowie
                          Sep 28 '18 at 15:04




                          This looked like a sound solution, so I held high hopes for it to work for me! Sadly it didn't. 😞 I do have two versions of Xcode installed, however. I will try removing one.
                          – jowie
                          Sep 28 '18 at 15:04











                          0














                          (most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings



                          (less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)






                          share|improve this answer


























                            0














                            (most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings



                            (less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)






                            share|improve this answer
























                              0












                              0








                              0






                              (most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings



                              (less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)






                              share|improve this answer












                              (most likely solution) 1. Simulator-> Hardware-> Erase all contents and Settings



                              (less likely solution) 2. keychain-> upper right lock-> unlock and lock again (or the other way around)







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered May 7 '18 at 20:00









                              Will Gwo

                              15315




                              15315























                                  0














                                  This happens on my machine, when I set the 'new build system'
                                  Go to menu file=>workspace settings and set Build System to "Standard".






                                  share|improve this answer


























                                    0














                                    This happens on my machine, when I set the 'new build system'
                                    Go to menu file=>workspace settings and set Build System to "Standard".






                                    share|improve this answer
























                                      0












                                      0








                                      0






                                      This happens on my machine, when I set the 'new build system'
                                      Go to menu file=>workspace settings and set Build System to "Standard".






                                      share|improve this answer












                                      This happens on my machine, when I set the 'new build system'
                                      Go to menu file=>workspace settings and set Build System to "Standard".







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 27 '18 at 6:15









                                      ThorstenC

                                      795619




                                      795619






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Stack Overflow!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.





                                          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                          Please pay close attention to the following guidance:


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f44651029%2fxcode-9-could-not-attach-to-pid%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          Guess what letter conforming each word

                                          Port of Spain

                                          Run scheduled task as local user group (not BUILTIN)