4

When I'm running in Simulator my application built in Xcode 6 / iOS SDK beta 3, SecItemCopyMatching function is returning -34018 error code (errSecMissingEntitlement).

OSStatus result = SecItemCopyMatching ((__bridge CFDictionaryRef)retrieveQueryDict, (CFTypeRef *)&dataRef);

I've noticed that problem in beta 1, then in beta 2 it was fixed. Furthermore, it was mentioned by Apple in the release notes as known issue of beta 1, fixed in beta 2. So far, so good. But then, in beta 3 this error occurs again, in the same exact place. But this time no explanation.

Anyone else has experienced that issue, or have some workaround? This should occur on Simulator only (at least that was the case with beta 1; at the moment I don't have a device to check), however for unit tests it's a blocker.

Marcin
  • 1,823
  • 3
  • 16
  • 18

3 Answers3

2

I had exactly the same scenario as you. I'm using SSKeychain, but it appears to be the same issue for everyone. Even though the release notes don't indicate it, the problem seems to in both iOS 8 beta 1 and in beta 3, skipping beta 2.

The workaround I used is based off some answers to: SecItemAdd and SecItemCopyMatching returns error code -34018 (errSecMissingEntitlement)

Here's what worked for me: I signed into my developer account in Xcode 6, then enabled "Keychain Sharing" in the relevant project target's capabilities tab.

Community
  • 1
  • 1
dwsolberg
  • 879
  • 9
  • 8
  • How did you manage to sign into your developer account in Xcode 6? Apparently it is giving a "Could not parse server's response a plist" error. http://stackoverflow.com/questions/24670014/xcode6-could-not-parse-servers-response-as-a-plist https://devforums.apple.com/message/1001283#1001283 – anavarroma Jul 10 '14 at 08:15
  • @dwsolberg, I've seen that topic. Then problem is I'm developing static library, so in my project there's no Capabilities tab, where I could set "Keychain Sharing" (as it’s not the standalone application). – Marcin Jul 10 '14 at 08:17
  • @Marcin The thing that turning on "Keychain Sharing" actually did that ended up fixing this for me was to add a `keychain-access-groups` property to my app's entitlements file. If you don't have an entitlements file already you may have to create one and assign it to the `Code Signing Entitlements` setting in Build Settings. – devios1 Jun 12 '15 at 00:52
1

I still had the problem with Keychain Sharing enabled, but now I have fixed this problem (I think). I had a wildcard provisioning profile on my device that showed it did not have a valid signing identity. I also had a provisioning profile for my app that was valid. When I deleted the wildcard profile, I stopped getting the -34018 errors.

I also made sure that the code signing identity and provisioning profile listed in the Code Signing section of the Build Settings of the target were identical to the one for the app (not the generic "iPhone Developer" one)

Dave Hirsch
  • 197
  • 13
  • For me this error (-34018) no longer appears also in beta 5, even without any workarounds. Looks like it's fixed. – Marcin Aug 08 '14 at 08:19
0

Fixed in beta 4. No info in the release notes though.

Marcin
  • 1,823
  • 3
  • 16
  • 18