如何在 iOS 应用程序之间共享钥匙串数据 [英] How to share keychain data between iOS applications

查看:44
本文介绍了如何在 iOS 应用程序之间共享钥匙串数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在描述一个问题,我花了很长时间才知道答案.

I am describing a problem for which it took me quite some time to learn the answer.

GenericKeychain" 示例是在 init 中使用 accessGroup 时提供用于在应用程序之间共享钥匙串数据的包装器的良好开端.

The "GenericKeychain" example is a good start at providing a wrapper for sharing keychain data between applications when using the accessGroup in the init.

然而,在我的应用程序中实现这一点会产生一个模糊的错误代码(需要很长时间才能定位)-25243,这意味着:没有访问控制.

However, implementing this in my app yielded an obscure error code (which took forever to locate) -25243, which means: No access control.

我在 iPad 上运行 Apple 的示例应用程序 (GenericKeychain) 却遇到了同样的错误.嗯?

I ran Apple's example app (GenericKeychain) on my iPad only to get the same error. Huh?

Apple 的文档是否未能提供实现此目标所需的内容?

Does Apple's documentation fail to deliver on what is necessary to accomplish this?

推荐答案

在整个网络上进行了一些(大量)挖掘之后,我找到了答案.您在构建 KeychainItemWrapper 类时使用的访问组还必须在keychain-access-groups"部分的每个应用程序的 Entitlements.plist 文件中指定.

After some (a lot of) digging throughout the web, I found the answer. The access Group that you use when constructing your KeychainItemWrapper class must ALSO be specified in each of your application's Entitlements.plist file in the "keychain-access-groups" section.

现在我看到钥匙串访问组"似乎很明显.然而,我什至不知道去那里看看.希望这对其他人有帮助.

It seems almost obvious now that I see "keychain-access-groups". However, I had no idea to even look there. Hope this helps others.

这篇关于如何在 iOS 应用程序之间共享钥匙串数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆