Keychain APIs fail in unhosted unit tests on Xcode 9, don't under 8

Originator:apontious
Number:rdar://34838798 Date Originated:10/5/2017
Status:Closed Resolved:10/9/2017
Product:Developer Tools Product Version:9.0
Classification:Bug Reproducible:Always
 
Summary:
The same Keychain API calls fail when run in the Simulator in Xcode 9 in unhosted unit tests, but succeed in hosted unit tests, and they succeed in both cases on Xcode 8.

Steps to Reproduce:
- Install both Xcode 8.3.3 and Xcode 9.0.
- Clone repository from https://github.com/apontious/Secrets.
- Download and install iOS 9.0, 9.2, 10.0, and 10.2 SDKs.
- Open Xcode 8.3.3.
- Open Secrets project and test (Cmd-U) on all downloaded SDK versions. All tests succeed on all SDK versions.
- Close Xcode 8.3.3 and the 8.3.3 Simulator.
- Open Xcode 9.
- Open Secrets project and test (Cmd-U) on all downloaded SDK versions, and on the iOS 11 SDK included with Xcode 9.

Expected Results:
- All tests succeed on all SDK versions.

Actual Results:
- Despite being exactly the same test running on exactly the same downloaded Simulators, only the tests on the iOS 9.* SDKs and the hosted tests on iOS 10 and 11 SDKs succeed under Xcode 9.

Under Xcode 9, the iOS 10.* SDKs with the unhosted tests fail with the error -34018 ("A required entitlement isn't present").

Under Xcode 9, the iOS 11 SDK with the unhosted tests fail with the error -50 ("One or more parameters passed to a function were not valid").

Version/Build:
Xcode 9.0 with iOS 9.*, 10.*, and 11 SDKs.

Configuration:
macOS Sierra 10.12.6

Comments

Apple Developer Relations response on 10/9/2017:

APIs need to run in a properly entitled process, i.e. "hosted" in the terminology used.


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!