Intermittent keychain error -34018 (errSecMissingEntitlement)

Originator:kelan
Number:rdar://25221910 Date Originated:2016-03-17
Status:Open Resolved:
Product:iOS Product Version:iOS 9.2.1 (13D15)
Classification:Serious Bug Reproducible:Sometimes
 
Summary:
When running a development build of our iOS app on a real device, from Xcode, with the debugger attached, we often get error `-34018` when trying to read from the keychain.

It seems to be the issue described in this thread on the Developer Forums: https://forums.developer.apple.com/thread/4743

Steps to Reproduce:
When our app launches, we want to read a saved authorization token from the keychain, so we can connect to our server.  We do this on the main thread, directly within `-application:didFinishLaunchingWithOptions:`.

Expected Results:
Successfully read from the keychain, to get the saved auth token.

Actual Results:
We get error -34018

Version:
iOS 9.2.1 (13D15)

Notes:
Once we hit this error, it seems all attempt to access the keychain will fail (with the same error).

If we simply relaunch the app, it will often succeed.

Configuration:
iPhone 6

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!