Tom Kraina
Tom Kraina

Reputation: 3689

Keychain SecOSStatusWith error:[-34018]

I'm having issues with accessing Keychain on a device. This happens only when the app is launched from Xcode. If I launch the app by myself (by tapping on its icon) the Keychain works without any problems. No issues in simulator either.

Console output:

Jan 27 14:33:24 iPhone MyApp[4305] <Error>:  SecOSStatusWith error:[-34018] The operation couldn’t be completed. (OSStatus error -34018 - Remote error : The operation couldn't be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements))
Jan 27 14:33:24 iPhone securityd[77] <Error>:  securityd_xpc_dictionary_handler MyApp[4305] delete The operation couldn’t be completed. (OSStatus error -34018 - client has neither application-identifier nor keychain-access-groups entitlements)

I'm using Xcode 6.1.1 and iPhone 5 with iOS 8.1.1.

It's worth noting that the app I'm trying to debug has the code for accessing keychain as located in a Cocoa Touch framework target (This could be the source of the problem).

The provisioning profile is a generic one: iOSTeam Provisioning Profile: * (Managed by Xcode)

Upvotes: 5

Views: 5600

Answers (4)

hstdt
hstdt

Reputation: 6243

Xcode 8 bug may also lead this.

Github issue: KeychainAccess issue

Upvotes: 0

HeTzi
HeTzi

Reputation: 916

Try disabling all breakpoints when launching the app from Xcode. You can enable them afterwards.

Upvotes: 2

bllakjakk
bllakjakk

Reputation: 5065

There are 2 ways you can resolve this issue.

  1. Add entitlement file to your project. enter image description here

  2. Forcefully add folder code signing to your target through code signing.

codesign --verify --force --sign "$CODE_SIGN_IDENTITY""$CODESIGNING_FOLDER_PATH"

enter image description here

Upvotes: 1

Alex Nauda
Alex Nauda

Reputation: 4536

In the Build Phases of your Target add a Run Script containing:

codesign --verify --force --sign "$CODE_SIGN_IDENTITY" "$CODESIGNING_FOLDER_PATH"

Example: adding a Run Script

I'm not sure why this should be required, but it worked for me to overcome a very similar error.

Upvotes: 0

Related Questions