On 30 Nov 2012, at 23:05, Dave Fernandes <dave.fernan...@utoronto.ca> wrote:
> > On 2012-11-30, at 4:46 PM, Mike Abdullah <cocoa...@mikeabdullah.net> wrote: > >> >> On 30 Nov 2012, at 18:59, Dave Fernandes <dave.fernan...@utoronto.ca> wrote: >> >>> >>> On 2012-11-30, at 6:42 AM, Mike Abdullah <cocoa...@mikeabdullah.net> wrote: >>> >>>> One way to look at it is that NSPersistentDocument pretty much painted >>>> itself into a corner from day 1, and it's too messy for Apple to untangle >>>> that. >>> >>> Can you elaborate? >> >> Well it makes the assumptions that your document: >> >> - is comprised of a single Core Data store >> - has a single managed object context > > This definitely limits your options. But, is it necessary to support file > wrappers and iCloud? (Just trying to educate myself about how documents work.) I don't understand your question here. Are you asking if my list of assumptions are necessary conditions for iCloud and file wrapper support? > >> - works entirely on the main thread > This one is already opt-in for both opening and saving, so fragility > shouldn't be an issue to upgrading the class. > > [Aside: As far as I know you *can* actually open an NSPersistentDocument > asynchronously. At least I haven't seen anything that says you can't, and it > seems to work on every system I've tried it on.] Well you would appear to be breaking Core Data's threading contract by doing so. In theory, MOCs know the thread they were created on. So by creating the document on a background thread, you are also creating the MOC on that thread and giving it the wrong idea about the thread it will be used on. On 10.7+ you can of course tell the context at creation time it's for the main thread, but I'd be a little surprised if NSPersistentDocument is doing that. I also covered the topic fairly recently: http://www.mikeabdullah.net/concurrently-open-core-data-docs.html _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com