问题
I'm getting this error on compilation with Xcode 8.1 and Swift 3:
Swift stdlib tool Error
The end of the compile log looks like:
/Users/..../Library/Developer/Xcode/DerivedData/.../Build/Products/Debug/.../Contents/Frameworks/libswiftCore.dylib: replacing existing signature
/Users/..../Library/Developer/Xcode/DerivedData/.../Build/Products/Debug/.../Contents/Frameworks/libswiftCore.dylib: CSSMERR_CSP_INVALID_CONTEXT_HANDLE
In architecture: x86_64
Probing signature of /Users/..../Library/Developer/Xcode/DerivedData/.../Build/Products/Debug/.../Contents/Frameworks/libswiftXPC.dylib
/usr/bin/codesign '-r-' '--display' '/Users/..../Library/Developer/Xcode/DerivedData/.../Build/Products/Debug/.../Contents/Frameworks/libswiftXPC.dylib'
error: Task failed with exit 1 signal 0 {
/usr/bin/codesign '--force' '--sign' '-' '--verbose' '/Users/..../Library/Developer/Xcode/DerivedData/.../Build/Products/Debug/.../Contents/Frameworks/libswiftCore.dylib'
}
The very strange thing is that if I copy the folder with the project to my Desktop, it does compile without the error. If I copy it elsewhere, it errors. Moving it back and forth a couple of times to verify, finally after the third move, it's erroring on the Desktop as well.
Any ideas?
Many thanks in advance.
回答1:
The non-deterministic nature of the symptoms makes me think it's a problem with stale data in Xcode's DerivedData
folder.
Trash the contents of /Users/..../Library/Developer/Xcode/DerivedData/
, this should solve your issue.
Deleting the content of this folder is not problematic because Xcode will recreate what it needs if it's missing.
回答2:
I had the same issue earlier today.
I am new to Xcode and swift and have just started experimenting. In one of the first tutorials it suggests compiling for a simulator and then trying to compile for your device.
When I compiled for my device it asked for my keychain password, the first time I tried I got my password wrong, assuming it was not necessary I clicked the deny access to the keychain button.
I read a few stack overflow queries on the same topic and found one which suggested rebooting the Mac.
This worked for me.
- restart your Mac
- open your Xcode project
- select your device as a target
- compile
- enter keychain password and click Allow or Always Allow
回答3:
If clearing DerivedData
didn't work for you, try re-downloading all profiles and then make sure you have iOS Development in your certifications.
You can make sure by checking this: Open Xcode → Xcode → Preferences → Accounts. Click on your appleId in the list, click Download All Profiles, and wait for it to download all profiles. Then click Manage certifications → click + sign → iOS Development.
回答4:
A simple reboot fixed the issue for me.
回答5:
In my particular case neither deleting the DerivedData
directory nor restarting my computer worked.
I believe my problems before encountering the Swift stdlib tool Error
originated when I created an Apple ID (free) provisioning profile when I was prompted for my system / root password by Xcode to allow access to a key in Keychain and I entered my password but I clicked on the Allow button.
This caused Xcode to prompt me again for the password non-stop and no matter how many times I entered it it would not accept it. I then erroneously pressed Esc
key assuming that Xcode had accepted my password the first time but simply was just glitching out.
Nevertheless, I was wrong and from that point on it never prompted me for my password to access my Keychain key but, instead, every time I tried to build and run it would complain with the Swift stdlib tool Error
error when ever I tried to run my app on my iOS device.
To fix this I did the following:
- Deleted my login keychain as per this Apple documentation: Create a new login keychain, if necessary
- Deleted my Apple ID (free) provisioning profile saved in Xcode (i.e. Preferences > Accounts ) since it is tied to my old login keychain.
- Restarted my computer.
- Recreated my Apple ID (free) provisioning profile (and this will prompt you again for your system password to access your key in your Keychain. This time enter the password but instead of clicking on the Allow button click on the Always Allow button. Not sure why that works but it did.
One major caveat to this solution:
Deleting your login keychain will cause your computer to log you out of many applications where you might have previously saved passwords. For example, I use the Spark mail app client and it caused me to have re-enter my individual e-mail (Gmail) account passwords, it also logged me out of the Evernote app. So, be warned! Nevertheless, it was not that big a deal in my cause, cause I can simply log in again. It's just annoying at worst.
回答6:
As with racl101 (https://stackoverflow.com/a/49266114/3612595), neither deleting the DerivedData directory nor restarting the computer resolved the issue.
To avoid deleting the login keychain, the following resolved the issue for me:
- Close Xcode
- Change the login keychain password (to something other than the current password)
- Reopen your Xcode project and attempt to compile again. When prompted for your password select 'Always Allow'
Repeat this process if you wish to change your login keychain password back to the original value.
回答7:
My success 3 steps:
1) reboot device
2) restart Mac
3) delete the folder /Users/YOR-NAME/Library/Developer/Xcode/DerivedData/ (listed in your error report)
回答8:
I had the same issue earlier today.
I am new to Xcode and swift and have just started experimenting. In one of the first tutorials it suggests compiling for a simulator and then trying to compile for your device.
When I compiled for my device it asked for my keychain password, the first time I tried I got my password wrong, assuming it was not necessary I clicked the deny access to the keychain button.
- Use a new bundle identifier to create new certificate. After this
- Enter your Keychain Password which is your system password by default
来源:https://stackoverflow.com/questions/40567666/swift-stdlib-tool-error