Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Keychain and App group in iOS

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 ?

like image 872
henry Avatar asked May 25 '15 13:05

henry


People also ask

What is keychain group in iOS?

An access group is a logical collection of apps tagged with a particular group name string. Any app in a given group can share keychain items with all the other apps in the same group. You can add an app to any number of groups, but the app is always part of at least one group that contains only itself.

What is an app Group iOS?

App Groups are the scheme iOS uses to allow different apps to share data. If the apps have the right entitlements and proper provisioning, they can access a shared directory outside of their normal iOS sandbox.


1 Answers

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.

like image 172
Mukesh Avatar answered Oct 14 '22 06:10

Mukesh