Swift Sdtlib tool error: Task failed with exit code 1

61,265

Solution 1

I use macOS High Sierra, Xcode 9.3: This worked for me.

  1. Go to /Users/JohnAppleseed/Library/Developer/Xcode/DerivedData/
  2. Moved all the files to Trash, empty the trash
  3. Opened Xcode, Clean and Build.

Restarting xcode or macbook, dragging and dropping certificate in the keychain did not work for me.

Solution 2

Ok so I solved this, don't know if it's the right way or not.

Moved my iOS developer certificate from local to system using Key Chain.

Steps:

  1. Close Xcode.
  2. Open Key Chain.
  3. Find the iOS Developer cert in Local.
  4. Drag and drop the cert from Local to the System tab.
  5. Enter admin password when prompted.
  6. Start Xcode and build project for your device.

Solution 3

I had the same problem - I resolved it by restarting my MacBook several times.

Solution 4

In my case, it was solved by

  1. Close Xcode.
  2. Clean Derived data.
  3. Open Xcode.
  4. Clean Product.
  5. Run your app.

Solution 5

First make sure your certificates haven't expired and then follow the steps listed by king foot:

Move the iOS developer certificate from local to system using Key Chain:

  1. Close Xcode.
  2. Open Key Chain.
  3. Find the iOS Developer cert in Local.
  4. Drag and drop the cert from Local to the System tab.
  5. Enter admin password when prompted.
  6. Start Xcode and build project for your device.
Share:
61,265

Related videos on Youtube

kingfoot
Author by

kingfoot

Updated on June 17, 2020

Comments

  • kingfoot
    kingfoot almost 4 years

    So randomly after several hours of work this morning on my app, Xcode just stopped letting me test my app on my iPhone. But I can still test it in the simulator.

    Now, when I build a project (note: ANY project, even blank single view project that was just created), I get the following error;

    Codesigning /Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib /usr/bin/codesign '--force' '--sign' '64F8B22715267CC0910110D9C97A2567591C0235' '--verbose' '/Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib' 
    
    SecKey API returned: -25304, (null)/Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib: unknown error -1=ffffffffffffffff error: Task failed with exit 1 signal 0 {    /usr/bin/codesign '--force' '--sign' '64F8B22715267CC0910110D9C97A2567591C0235' '--verbose' '/Users/name/Library/Developer/Xcode/DerivedData/testProject-brzcahttttlkoqeczajhqslodkkn/Build/Products/Debug-iphoneos/testProject.app/Frameworks/libswiftCore.dylib'
    

    I'm running Xcode 8.2 on macOS Sierra 10.12.12, testing on an iPhone 6s with iOS 10.1.1.

    Note: I have reinstalled Xcode after fully removing it from my machine, as well deleting and recreating all my provisioning profiles for all hardware.

    • mikeT
      mikeT over 6 years
      All other solutions didn't work Easiest solution is to use freemacsoft.net/appcleaner App cleaner, remove Xcode completely with it's resources and preferences (it'll take a while). And re-install Xcode. The issue happened when Xcode pop-up asking for password (when using simulator), I kept putting it in, and it kept asking for it over and over. So I clicked declined. When running the Xcode simulator for the first time, make sure you type the password & click Always Allow (Not sure of the wording), it will prompt you 3-4 times. After that it was Perfect.
  • James Toomey
    James Toomey over 6 years
    This totally worked, so thank you, but how in the world did you figure it out? In my case it was in the login keychain, so when I dragged it to the System keychain, it actually copied it over, not moved it.
  • Alexander
    Alexander over 6 years
    your certificicate what certificate?
  • kingfoot
    kingfoot over 6 years
    @JamesToomey Honestly? I don't remember at all. But I do know that in the future if this happens, I know where to look. Hopefully this thread can help people find where to look too. I wish I had more explanation to give, so as to provide a greater understanding, but I don't fully understand it myself haha.
  • Luke Eckley
    Luke Eckley over 6 years
    When I got to step 4 here Keychain said the Cert was invalid. I just deleted the iOS Developer key and created it again in Xcode. Worked fine after that.
  • rgkobashi
    rgkobashi about 6 years
    The certificate that your provisioning profile uses no sign your app. This whole provisioning/certificate thing can be a little tricky, you can read this article which explains how the whole thing works. In my case was the distribution certificate (iPhone Distribution: XXXXX)
  • rgkobashi
    rgkobashi about 6 years
    Thanks! It worked for me too. However I am curious why doing this will fix that, and I think it works because the keys stored on System keychain the access control is set to "Allow all applications to access this item" by default, and on Login keychain you need to specify what apps.
  • Roozbeh Zabihollahi
    Roozbeh Zabihollahi about 6 years
    Restarting my Mac fixed the problem :-)
  • Brian Bird
    Brian Bird about 6 years
    I tried clean, restarting Xcode did not work for me. I finally had to restart my Mac book pro running High Sierra and this resolved my issue.
  • kingfoot
    kingfoot almost 6 years
    Thanks for the update! This was done on my El Capitan MacBook Pro in 2016 so it doesn't surprise me things might have changed. I've selected this as an answer as well.
  • Jeremy Andrews
    Jeremy Andrews almost 6 years
    After trying all the other solutions this worked for me but with the difference - I only deleted files in DerivedData which had been currently used. I further removed all out-of-date certificates in KeyChain.
  • Søren Pedersen
    Søren Pedersen over 5 years
    Doesn't work for me, and I don't see any reason why it should either. The Apple dev community need to stop suggesting to delete derriveddata every time Xcode misbehaves.
  • Rolf Beh
    Rolf Beh over 5 years
    Oh damn - I cannot believe this. Restarting the machine fixed it for me as well. I am not sure, if I am on Windows or MacOS right now ;-)
  • Daniel Mavrakis
    Daniel Mavrakis over 5 years
    This worked for me, but I had the restart the macbook after deleting derived data to make it work.
  • Jeremy Andrews
    Jeremy Andrews over 5 years
    I don't recall how many times probably 2 or 3 times however I am not convinced that the restart alone did the trick I probably used the disk utility first aid and possibly a recovery restart and disk first aid as well.
  • Pengson
    Pengson over 4 years
    Works for me. Save my day. Thanks a lot.
  • Leap Hawk
    Leap Hawk over 3 years
    You can do it the same if facing in case of MacOS Development Certificate.