1

使用 SFHFKeychainUtils 的一些代码的调试构建在我正在开发的 mac 上正常工作,在另一台 mac 上触发错误:

该代码使用了 SFHFKeychainUtils 提供的以下方法:

+[SFHFKeychainUtils getPasswordForUsername:andServiceName:accessGroup:error:]

+[SFHFKeychainUtils storeUsername:andPassword:forServiceName:accessGroup:updateExisting:updateExisting:error:]

使用 为用户名添加密码+[SFHFKeychainUtils storeUsername:andPassword:forServiceName:accessGroup:updateExisting:updateExisting:error:]。一段时间后,尝试使用 检索密码+[SFHFKeychainUtils getPasswordForUsername:andServiceName:accessGroup:error:]。但是,此方法返回错误;它的域是SFHFKeychainUtilsErrorDomain,它的代码是-25293(所以它是errSecAuthFailed)。仅当密码实际上存储在钥匙串中时(或至少在钥匙串访问中可见时)才会返回此错误。

为什么会这样?

4

1 回答 1

4

问题是缺少代码签名。为了让第二台机器访问钥匙串,需要进行代码签名。修复是为调试版本启用代码签名。

于 2012-06-19T19:19:55.597 回答