Keychain error -34018 is Back

Just upgraded to Xcode 8b2 and launched an app I've been working on and got this erro:


[OSStatus] error:[-34018] Error Domain=NSOSStatusErrorDomain Code=-34018 "client has neither application-identifier nor keychain-access-groups entitlements" UserInfo={NSDescription=client has neither application-identifier nor keychain-access-groups entitlements}


Sounds just like https://forums.developer.apple.com/thread/4743 from last year. Seems like for now my app is unable to access the Keychain at all, at least in the simulator. Works fine when I run it on a device. Anyone else seeing this with iOS 10?

Replies

Happening to me too on iOS10 simulator, XCode8 Beta 6. Keychain sharing is enabled, but it didn't help. I couldn't find any way around this, only using actual device helps.

same for me as well. iOS 10 device working nicely, only simulator has problems.


sanityCheck = SecKeyGeneratePair((__bridge CFDictionaryRef)keyPairAttr, &publicKeyRef, &privateKeyRef);

Same here. Works on device, not in simulator.

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?

Yesterday I had same problem -34018 error in keyChain class. Xcode Version 8.0 (8A218a), iOS 10.

I solved this problem by downloading iOS 9.3 simulator. Now I simply start simulator with iOS 9.3 and the error disappears. I’ll wait until Apple solves this problem and only then I am going to start using iOS 10 Simulator.

Do you have an entitlements file for your app?

Thx @hacknicity,

just creating entitlements file, fixes it for simulator.

No

In my earlier comment I found just adding an entitlements file fixed the problem. it doesn't seem to matter what the entitlement is. I've not tried creating a plist with no actual entitlements, but even an "empty" file might work (it's not literally an empty file because it has the plist xml structure, but it would have no actual entitlements inside).

Just now I create entitlements file and .... everything works! (I meen in iOS 10 simulator) Thank you @hacknicity to very usefull advice. This file consist of two entries

<key>aps-environment</key>
<string>development</string>

be careful of side effects of enabling push notifications. You might get problems submitting the app for review or at runtime in production builds. I was able to add that entitlement for my app because I really do use push notifications.

Same issue here...

I use a library project in my application, we're unable to test on simulator because of this too (Xcode 8 GM).

It don't work with enabling Keychain sharing. Is there anyone encounter problem like me?

I have same issue in my static-library project. (Xcode 8.1 8B62)