xcode Codesign 返回未知错误 -1=ffffffffffffffff
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44173831/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Codesign returned unknown error -1=ffffffffffffffff
提问by Madhu Avinash
I tried to code sign an iOS application, These are the steps that i followed
我试图对 iOS 应用程序进行代码签名,这些是我遵循的步骤
security create-keychain -p password ${KEYCHAIN}
security set-keychain-settings -u -t 300 ${KEYCHAIN}
security list-keychains -d user -s login.keychain ${KEYCHAIN}
security import "" -k ${KEYCHAIN} -A -P "${PASSPHRASE}" -A >/dev/null
security unlock-keychain -p password ${KEYCHAIN}
/usr/bin/codesign -f -s $IDENTITY --keychain $KEYCHAIN --entitlements $ENTITLEMENTS Payload/Test.app
This returned me Codesign returned unknown error -1=ffffffffffffffff via ssh.
这让我返回了 Codesign 通过 ssh 返回了未知错误 -1=ffffffffffffffff。
If i directly execute the code sign command in the machine, it's successfully signing.
如果我直接在机器上执行code sign命令,就签名成功了。
The issue is only in Mac OS Sierra.
问题仅在 Mac OS Sierra 中。
采纳答案by Gereon
Had the same problem a while ago, adding
前段时间遇到同样的问题,补充
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password ${KEYCHAIN}
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k password ${KEYCHAIN}
solved it for me.
为我解决了。
回答by Romano
Got the same issue but while archiving directly from Xcode. Sharing the solution in case it helps.
遇到了同样的问题,但直接从 Xcode 归档时。分享解决方案,以防万一。
Sometimes, Keychain seems to end up in a corrupted state. Using MacOS Sierra too.
有时,钥匙串似乎最终处于损坏状态。也使用 MacOS Sierra。
Symptoms :
症状 :
Relogin needed to access Accounts after restarting Xcode
Prompting for password while using Keychain Access for some operations
使用 Keychain Access 进行某些操作时提示输入密码
Keychain Access - Error while accessing login keychain via Change Settings for Keychain ...
钥匙串访问 - 通过更改钥匙串设置访问登录钥匙串时出错...
What fixes it for me is locking and unlocking (password required) the involved Keychain, loginin my case.
对我来说修复它的是锁定和解锁(需要密码)所涉及的钥匙串,在我的情况下登录。
回答by Tadas ?ubonis
I am going to chip in as well as I had to try a few more things than the ones mentioned here: the problem was that keychain doesn't like SSH sessions. I had to execute these in my session to fix it:
我将参与进来,因为我不得不尝试比这里提到的更多的东西:问题是钥匙串不喜欢 SSH 会话。我必须在我的会话中执行这些来修复它:
security unlock-keychain -p MY_PASS ~/Library/Keychains/login.keychain
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k MY_PASS ~/Library/Keychains/login.keychain
security set-keychain-settings ~/Library/Keychains/login.keychain
I've also removed my current certificates system/account certificates by removing my account from XCode (I use fastlane to do building) but I suspect that this shouldn't have impacted it.
我还通过从 XCode 中删除我的帐户(我使用 fastlane 进行构建)来删除我当前的证书系统/帐户证书,但我怀疑这不应该影响它。
回答by Simon H
@madhu I have been trying to fix the same issue and found that Access Control for the key associated with the certificate in question was set to "Confirm before allowing access" which didn't work in Jenkins. I modified it (thru Keychain Access gui - Get Info, Access Control) to "Allow all applications to access this item" and my build was successful.
@madhu 我一直在尝试解决同样的问题,发现与相关证书关联的密钥的访问控制设置为“在允许访问之前确认”,这在 Jenkins 中不起作用。我将它(通过 Keychain Access gui - 获取信息,访问控制)修改为“允许所有应用程序访问此项目”,我的构建成功。
回答by pmacro
This happens in a headless build because the prompt for key access cannot be shown or responded to. The solution is to prevent that prompt from showing by granting access to the key in advance.
这发生在无头构建中,因为无法显示或响应密钥访问提示。解决方案是通过提前授予对密钥的访问权限来防止显示该提示。
Open Keychain Access, find the key for your signing certificate (login-> Certificates, then expand the certificate to reveal its key). Right-click on the key and select: Get Info -> Access Control, and select "Allow all applications to access this item".
打开钥匙串访问,找到签名证书的密钥(登录-> 证书,然后展开证书以显示其密钥)。右键单击该键并选择:获取信息 -> 访问控制,然后选择“允许所有应用程序访问此项”。
回答by Dan Lee
You might have exported some file like p12 from KeyChain, and when OS asked for your root password, and you denied it, then Xcode will code sign error with this info.
您可能已经从 KeyChain 中导出了一些像 p12 这样的文件,当操作系统要求您提供 root 密码而您拒绝时,Xcode 将使用此信息进行代码签名错误。
If this maybe so, you should repeat the above action, input your password and click allow, and then it will be ok to code sign.
如果是这样,您应该重复上述操作,输入您的密码并单击允许,然后代码签名就可以了。
回答by RAM237
I've tried almost all the existing suggestions over the web, none of them helped...
我已经尝试了几乎所有网络上现有的建议,但没有一个有帮助......
Finally only re-generating the Provisioning Profile (for AdHoc), re-downloading it and placing it to ~/Library/MobileDevice/Provisioning Profiles/
overwriting the existing one saved my life.
最后只重新生成配置文件(用于 AdHoc),重新下载并~/Library/MobileDevice/Provisioning Profiles/
覆盖现有配置文件,这挽救了我的生命。
By the way, AppStore build was successful all this time, so the issue was definitely in the AdHoc profile itself (pretty strange, since it looked nice by all means).
顺便说一下,AppStore 构建一直是成功的,所以问题肯定出在 AdHoc 配置文件本身(很奇怪,因为它看起来很不错)。
回答by Its not blank
Even though we installed the right certs in the keychain and the right Provisioning Profile under ~/Library/MobileDevices/Provisioning Profiles.
即使我们在钥匙串中安装了正确的证书,并在 ~/Library/MobileDevices/Provisioning Profiles 下安装了正确的 Provisioning Profile。
We may also see
我们也可以看到
unknown error -1=ffffffffffffffff
For this error, I tried the below steps to fixed the issue:
对于这个错误,我尝试了以下步骤来解决这个问题:
- Reboot the machine, unlock keychain using "securify unlock-keychain", lock the keychain again
- Remove ~/Library/Developer/Xcode/DerivedData folder.
- Run carthage bootstrap --platform iOS
- Open the source code syncing down workspace, run "xattr -rc ." then open the .xcodeproject file in xcode.
- Turned on the automatic signing for each target. Need to login with valid credentials.
- Click on the provisioning profile under signing.
- unlock the keychain again
- Changing the build device to Generic Devices, under Product --> Clean, then Product –> Archive
- There will be a keychain access allow showed up, click "Always Allow".
- You should make sure the archive is successful then trigger the Jenkins job again.
- 重启机器,使用“securify unlock-keychain”解锁钥匙串,再次锁定钥匙串
- 删除 ~/Library/Developer/Xcode/DerivedData 文件夹。
- 运行 carthage bootstrap --platform iOS
- 打开同步工作区的源代码,运行“xattr -rc”。然后在 xcode 中打开 .xcodeproject 文件。
- 为每个目标打开自动签名。需要使用有效凭据登录。
- 单击签名下的配置文件。
- 再次解锁钥匙串
- 将构建设备更改为通用设备,在 Product --> Clean 下,然后 Product --> Archive
- 将出现钥匙串访问允许,单击“始终允许”。
- 您应该确保存档成功,然后再次触发 Jenkins 作业。