Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I access my own 2 iOS app database from each other

I am developing two iOS app and I want to access their database from each other.

Eg. APP1 and APP2 both developed by me, APP1 can access APP2 database and vice-versa

I read somewhere that same iOS app developer can have sandbox access authorities to access their own developed iOS app.

like image 621
hpDev_iOS Avatar asked Nov 26 '22 06:11

hpDev_iOS


1 Answers

Yes, you can do this. You create an app group, put both apps in the same app group. Any files created in the shared file area are available to both apps. It works exactly the same way an extension shares files with its host app.

I'm currently using this to share a SQL DB between two different apps.

The shared file are can be accessed via the file manager:

NSFileManager* fileMgr = [NSFileManager defaultManager];
NSURL* sharedDirectory = [fileMgr containerURLForSecurityApplicationGroupIdentifier:appGroupId];
like image 148
progrmr Avatar answered Nov 28 '22 18:11

progrmr