使用 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
)。仅当密码实际上存储在钥匙串中时(或至少在钥匙串访问中可见时)才会返回此错误。
为什么会这样?