iOS app groups sharing SQLite databases, notifications
iOS app groups sharing SQLite databases, notifications
- Subject: iOS app groups sharing SQLite databases, notifications
- From: Jens Alfke <email@hidden>
- Date: Mon, 23 Jan 2017 13:20:03 -0800
I’m looking into the feasibility of sharing a SQLite database between multiple iOS apps by the same developer, using an “app group”.
The app group entitlement grants a shared directory where the database file can be stored, but SQLite also relies on file locking and shared memory (via a mapped file) to arbitrate access. The Apple docs I’ve seen don’t explicitly say whether those mechanisms will work. I can’t think of any reason they wouldn’t work for any file that both processes have access to, but it would be nice to have confirmation. Have other people successfully shared SQLite databases using an app group?
I’ll also be needing some limited inter-process notifications, so that one app can notify the others after it makes changes in the database. Most of the time this won’t be necessary since generally only one app is active, but there can be situations where a backgrounded app can modify the database, e.g. if it receives a push notification while in the background, or if it uses a background task to finish some activity after being backgrounded.
Apple’s docs say that Mach IPC and Unix domain sockets can be used; but I’ve used both in the past and they’re rather low-level and messy. The CFNotification “Darwin Notification Center” seems like a better approach; it’s available on iOS, and the docs say it’s implemented using Mach notifications, which should work. Has anyone used it within an app group?
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden