6
votes

As you know that when we share data between two apps in iOS, we can use keychain. And iOS8 later, we can also use app groups to implement the same function; My question is what's the difference between keychain and app groups, which one will be better and why ?

1

1 Answers

6
votes

Keychain

If we save the data in the keychain, it still remains there when you uninstall the app unless it is completely reset.

For example, you might implement some login functionality and save it in the keychain. If the user uninstalls the app later then re-installs the app, you can grab those values from the keychain.

App groups

App groups are mainly used when you want to share data (for example SQLite or Core Data) between your apps.

For example, if your app has a widget and it wants to get data from SQLite or Core Data, then you would create an app group and save the SQLite or Core Data file in that app group path instead of the app's document directory. Now both your widget and app can track the changes in your DB file.

These are some common examples of the things you asked.