Get "No Keychain Available" Error When Try to Access Keychain from App Extension

An error occurred when accessing the keychain

I didn't add the Team ID prefix before my App ID, so it didn't work. You need to have an Apple Developer Account and a Team ID in order to do this, like this:

Auth.auth().useUserAccessGroup("XK********.com.matkonit.SharedItems")

Swift Signing User in with Access Group not working

I don't know how this could happen, but the string for the access group is wrong in your entitlements.

It should be $(AppIdentifierPrefix)com.wishlists-app.group instead of $(AppIdentifierPrefix)SN26HDFT24.com.wishlists-app.group.

Your extension must have the same app group and keychain group activated. I can't see anything of your app extension. Then you must also call useUserAccessGroup("SN26HDFT24.com.wishlists-app.group") in your extension.

Keychain access on watchOS 2 not working on the actual watch

Issue has been fixed by Apple in the recent watchOS 2 beta 5.

Retrieve google user from ios extension

No answer until now. I finally rewrite the Google login by using Aerogear framework. Now I can able to login from both main target and extension target. This also fix this google logout issue.

Not able to access ionic plugin keychain key value pair in iOS from share extension code.

In ionic I had to use app preferences plugin. this gave me access to the user defaults although to fetch the group had to change the ionic plugin code so that I could share user defaults saved in ionic and fetch the same thing in app extension.

Plugin
https://ionicframework.com/docs/native/app-preferences/

//ionic code
let dict12 = this.appPref.suite('group.xxxxxxx')
this.appPref.store('group.pmshare', 'keyNa', 'valueNa')
console.log('dict: ' + dict12)
this.appPref.fetch('group.pmshare', 'keyNa').then(str => {
console.log('str: ' + str)
})

// shared extension code
var defaults = UserDefaults.init(suiteName: "group.xxxxxxx")
print(defaults?.string(forKey: "keyNa"))
defaults?.set("fromExtValue", forKey: "fromExt")

Always remember to create a group under target->app groups->ON

Same group will be used to share data between both the applications.

This can be actually used for Inter Application Communication in iOS. When the app is developed using Ionic.

iOS 8 notification action: Access to item attempted while keychain is locked error when accessing keychain in didFinishLaunchingWithOptions

This error is definitely caused by trying to access an item that is kSecAttrAccessibleWhenUnlocked while device is still locked. You can tell this just by looking at the following line of the log you've provided:

securityd[32279] <Error>:  securityd_xpc_dictionary_handler Okta Verify[32480] copy_matching The operation couldn’t be completed. (OSStatus error -25308 - ks_crypt:     e00002e2 failed to unwrap item (class 6, bag: 0) Access to item attempted while keychain is locked.)

Class 6 is kSecAttrAccessibleWhenUnlocked (and kSecAttrAccessibleAlways is class 8) – see slide 15 of this deck for more details – so the behaviour you're seeing is expected.

The real question now is why the item ends up as kSecAttrAccessibleWhenUnlocked while you think it's kSecAttrAccessibleAlways. It is hard to tell without seeing more code and/or having more information, but here are few things to consider:

  • Keychain items are not removed when app is uninstalled – they do survive app reinstallation/upgrade. So if an earlier version of the app created an item as kSecAttrAccessibleWhenUnlocked it could have just carried on. Try removing the item and creating it again (and check return values of SecItemDelete() and SecItemAdd() to be sure it's done).
  • Double check that kSecAttrAccessibleAlways is passed to SecItemAdd() so that iOS doesn't apply any defaults on its own.
  • Note that accessibility class must be passed when creating item (i.e. to SecItemAdd()) and not when retrieving it (i.e. not to SecItemCopyMatching()). This is kind of obvious but it never hurts to reiterate.

If none of the above helps please post relevant code showing how the item is created and then how it's read.



Related Topics



Leave a reply



Submit