Keychain sharing between applications on iOS

Anshu Kumar
2 min readAug 17, 2017

--

Keychain sharing is used when we want to share some data securely between two or more applications from the same developer.

Suppose we want to share some critical data(like username and password) between two apps. So for that goto the first project in xocde and select project in project navigator -> Select Capabilities -> turn on keychain sharing

By default the keychain group name will be your App bundle identifier but you can change it and give some meaning full name(like SharedKeychain).

Now do the same thing for your second app and give the same name to keychain group.

Now you have a shared key chain group and both apps can read and write to it.

Note: Sometime Xcode show error when enable keychain sharing.To fix the issue just Quit the Xcode and relaunch(Seems Xcode bug)

Now let’s test it.For that from the first application write to the keychain group

And from the second app read the content from keychain group written by first application.

The SwiftKeychainWrapper is a library to read and write to keychain.

Note: The keychain group name should be prefix with your Team ID which you can find from apple member portal.

Happy Coding ….

--

--