Re: Access Core Data from Multiple Apps?
Re: Access Core Data from Multiple Apps?
- Subject: Re: Access Core Data from Multiple Apps?
- From: "Joe Goh" <email@hidden>
- Date: Tue, 10 Apr 2007 17:36:12 +0800
Ooops, this is a resend of the earlier message which i've sent without
first editing the subject. I'm resending it so that the topic still
threads properly. Sorry everyone.
On 4/10/07, Dave Batton <email@hidden> wrote:
I know Core Data is not multi-user, but is there any recommended way
to access a core-data store from multiple applications by a single
user?
The widget will be read-only. I'd like the widget to be able to
search this data even while the application isn't running, so it will
need either direct access to the Core Data store, or it will need to
communicate with a background application that can access to the data
when the primary application isn't running.
I'm doing something like what you describe in my app, with my main app
running in read-only mode when it detects that the Treo conduit is
running (and possibly writing new data). Its not a Dashboard widget
though (and I know very little about widgets), so I can't say for sure
whether this method will work for widgets.
Searches work without any problem when the app is in read-only mode.
I don't know if my method is the recommended way, but my app's been in
the wild for 4 months now and i've not heard anyone with any problems
yet (fingers crossed).
So perhaps for your case too, you don't need the widget to only be
able to work when the application isn't running, which is sort of
wierd.
What i've done for my case is for the conduit to send a notification
to the main app when its running, which causes the main app to unload
the persistent store, and reload it as read-only. When this is done,
the main app replies to the conduit that its now in read-only-mode and
the conduit continues doing its work. When the conduit's done, it
sends another notification to the main app, which will then make the
main app reload the persistent store in the normal read-write mode.
Obviously, my method uses notifications and deals directly with
CoreData, so i'm not too sure whether this will work for Dashboard
widgets.
If anyone thinks that my method is horribly wrong and you have a
better solution, i'd love to hear it, as i'm not too sure myself
whether this is correct.
Cheers,
Joe Goh
FunkeeMonk Technology
http://www.funkeemonk.com/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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