How to setup keychain library tests in Xcode 8 / iOS 10
Update: The Keychin bug was fixed in Xcode 8.2. Now the unit tests work if Host Application is selected in your test target (see Step 3 below).
A Keychain is a secure storage in Apple devices used for keeping small bits of information like passwords. The testing of Keychain code has never been harder than in Xcode 8 and iOS 10. This tutorial shows thirteen easy steps (sorry for the sarcasm) that I needed to go through to make the unit tests work in the Keychain Swift library.
1. Turn on signing in the app target
- Open the General tab in your app target.
- Turn on Automatically Manage Signing and select your team in the Signing section.
2. Turn on the Keychain Sharing
- Open the Capabilities tab in your app target.
- Turn on the Keychain Sharing.
3. Finally, configure the test target
- Open the General tab in your test target.
- Select your app in the Host Application.
- Turn on Automatically Manage Signing and select your team.