iOS 10 simulators keychain error -34018

Hello,

When accessing the keychain, an access error (-34018) is returned for all simulators running iOS 10 beta.There are no issues with devices running iOS 10 beta and no issues with simulators running iOS 9.3.


Anyone else experience this? I also tried it with Apple's KeychainTouchID example source to confirm it wasn't an issue in my code. (I tried the secItemAdd() and secItemCopyMatching() without touchID).

thanks,

Neal

Accepted Reply

Adding the "Share keychain entitlement" fixes this issue.

Replies

Adding the "Share keychain entitlement" fixes this issue.

is this confirmed to be a requirement? seems like it shouldn't be necessary just to be able to use the keychain.

Anyone knows a workaround for Projects with framworks? My project is a Framework only project and my Unit Tests started failing with Xcode 8, I'm using the GM.


I can't do the Keychain Sharing because I don't have the Capabilties tab in a Framework Target.

Any ideas?

I second that. Also working on a Swift framework and can't build anymore because I'm using a Keychain-wrapping framework which itself doesn't build anymore due to the error. This is really unfortunate given that Xcode 8 and iOS 10 are officially released now. Hoping for a quick Xcode 8.0.1...

I found something interesting...


As others have reported, my app would always fail on SecItemAdd() with -34018 on the simulator but work fine on a device. I was about to add the 'Share keychain' entitlement as a workaround but noticed that Xcode 8 was prompting me to add the 'Push Notification' entitlement (that entitlement is now required to use push notificaitons on iOS 10 as the permission is taken from the entitlement rather than the provisioning profile in earlier versions). This *created* an entitlements file because the app didn't have one before. And without adding the 'Share keychain' entitlement the app suddenly started working! No more -34018. I've reverted back and forth and it seems pretty deterministic: no entitlements file gives -34018; entitlements file works.


So, my testing seems to show that SecItemAdd fails if there's no entitlement file, and works if there is one! Perhaps all the developers adding 'Share keychain' entitlement never had an entitlement file before and it is the creation of the file rather than the specific entitlement that fixes the problem?

Is there a way to add the "Share keychain" entitlement using Visual Studio (xamarin)? I'm not using XCode

Same. There is no work around for now. Very frustrating.

I had the same issue with running tests in a Swift framework and was able to resolve it by adding an app target to my framework project to serve as a test host app. The test host app will allow you to enable keychain sharing and then you can configure your test target to run in the host app.

This worked perfectly. Thanks alot!


Just to reiterate no need for "share keychain". Any entitlment will do.