Sharing Keychain data between app and extension

落爺英雄遲暮 提交于 2020-04-16 06:08:14

问题


I am not able to get data in extension using Keychain Access.

What did I do ?

  1. I have enabled the keychchain sharing capabilities in both the targets and gave the same identifier.
  2. I have initialized the Keychain like this:

    static let keychain = Keychain(service: "teamID.com.appname.ios.sharedKeychain", accessGroup: "teamID.com.appname.ios.sharedKeychain")

I have also tried with just service/access group while initializing.

Error in extension ?

OSStatus error:[-25291] No keychain is available. You may need to restart your computer.

Xcode 11.3.1, Swift: 5

What is the problem in this approach ? There are many questions regarding sharing data between App and extension but still I am not able to find what's missing.

Note: This code works well on simulator. Thanks.

来源:https://stackoverflow.com/questions/60126864/sharing-keychain-data-between-app-and-extension

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!