我正在开发一个 macOS 应用程序。我正在创建自己的钥匙串(keychain)。钥匙串(keychain)文件存储在磁盘上的特定位置。每次启动应用程序时,我都必须从此钥匙串(keychain)写入和读取数据。
我无法找到将项目添加到此特定钥匙串(keychain)的正确方法。我正在使用SecItemAdd()
。我想指定 SecItemAdd()
应将项目添加到哪个钥匙串(keychain)。
最佳答案
您尝试过SecKeychainSetDefault
吗?来自 description :
In most cases, your application should not need to set the default keychain, because this is a choice normally made by the user. You may call this function to change where a password or other keychain items are added, but since this is a user choice, you should set the default keychain back to the user specified keychain when you are done.
当然,您将需要其他调用来获取此调用所需的 SecKeychainRef
参数等,例如SecKeychainOpen
、SecKeychainCopyDefault
。
HTH
关于macos - 将项目添加到除默认值之外的特定 OS X 钥匙串(keychain),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44307298/