Multiple iOS apps with a single database and one login

I created several android applications with a single database (content provider), one login (which means that if I log in to one application, it should work for everyone, if I exit one application, it should exit all other applications) I need to open one application from another application, and every day I have to update all my data offline to the server (this should happen at a specific time every day). Now I'm going to connect this system (all applications) to iOS, is this possible on the iPhone? And I'm not going to send these applications to the application store.

+4
source share
2 answers

Yes it is possible. You will need to save your database in a container that you can use:

- (NSURL *)containerURLForSecurityApplicationGroupIdentifier:(NSString *)groupIdentifier;

The parameter groupIdentifiermust be the same for all applications and must be configured inside Target-> Capabilities-> application groups.

After you have configured the same application group for each application, you can use the above method to save the database in the location provided by the method. Thus, the same database would be available for all applications.

There is an NSUserDefaults init methid that accepts a username (appGroup) and creates generic UserDefaults that can be used for your sole login purpose.

- (instancetype)initWithSuiteName:(NSString *)suitename;

Cm:

containerURLForSecurityApplication

NSUserDefaults

+3

AppGroups . AppGroups, Single Sing-On, Bool , , .

+1

Source: https://habr.com/ru/post/1682739/


All Articles