5

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)

Tom Kraina
  • 3,569
  • 1
  • 38
  • 58

4 Answers4

2

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

HeTzi
  • 916
  • 9
  • 18
1

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

bllakjakk
  • 5,045
  • 1
  • 18
  • 28
  • I still have the problem happening. It only happens when my app is re-opened via a Deeplink with the following app delegate method: - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url If I just start the app, keychain writing works, and if I minimize and maximize the app, it still works. It's only when I re-open with the deep link that this problem occurs. I do have MyApp.entitlements configured in my project ( Keychain Sharing in the Capabilities tab) – FranticRock Oct 08 '15 at 13:45
0

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.

Alex Nauda
  • 4,126
  • 1
  • 24
  • 24
0

Xcode 8 bug may also lead this.

Github issue: KeychainAccess issue

hstdt
  • 5,652
  • 2
  • 34
  • 34