Re: Crash when NSPersistentDocument tries to present error during saveDocument:
Re: Crash when NSPersistentDocument tries to present error during saveDocument:
- Subject: Re: Crash when NSPersistentDocument tries to present error during saveDocument:
- From: "Kyle Sluder" <email@hidden>
- Date: Sat, 27 Dec 2008 17:58:47 -0500
On Sat, Dec 27, 2008 at 4:13 PM, Jerry Krinock <email@hidden> wrote:
>> BmxBk* bmxBk = [documentController openUntitledDocumentAndDisplay:NO
>> error:&error] ;
>> [bmxBk setFileURL:[NSURL fileURLWithPath:docPath]] ;
>> [bmxBk saveDocument:self] ;
I seem to recall that using -setFileURL: on an NSPersistentDocument is
a bad idea, though I could very well be mistaken. In any event, why
are you setting the file URL before the save? Looking at the
documentation for -[NSDocument saveDocumentAs:], the AppKit
implementation writes the document and then updates the fileURL
property to match. This is consistent with the documentation for
-fileURL (and -filePath), which states that it is a cache of the last
URL the file was saved at, not something that controls the document's
saving behavior.
I wouldn't be surprised if, since for data integrity purposes the
SQLite store does not keep the on-disk database file open, Core Data
is using -fileURL to get the path to the SQLite db, and then throwing
a hissy-fit because it isn't there.
So try reversing those calls: save the document using
-saveToURL:ofType:forSaveOperation:error:, and then call -setFileURL:.
HTH,
--Kyle Sluder
_______________________________________________
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