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: Jerry Krinock <email@hidden>
- Date: Sat, 27 Dec 2008 15:37:02 -0800
Thank you, Kyle. Actually, since -
saveToURL:ofType:forSaveOperation:error:
has a setFileURL built into it, I don't need setFileURL:
So, this works for creating an NSPersistentDocument programatically....
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
NSDocumentController* docCon = [NSDocumentController
sharedDocumentController] ;
NSError* error = nil ;
// Create a new empty NSPersistentDocument
MyDocument* doc = [docCon openUntitledDocumentAndDisplay:NO
error:&error] ;
NSLog(@"open error = %@", error) ;
// Save it to desktop
NSURL* url = [NSURL fileURLWithPath:@"/Users/jk/Desktop/
KylesWay"] ;
BOOL ok = [doc saveToURL:url
ofType:[doc fileType]
forSaveOperation:NSSaveOperation
error:&error] ;
NSLog(@"saved ok = %d", ok) ;
NSLog(@"save error = %@", error) ;
NSLog(@"fileURL = %@", [doc fileURL]) ;
}
_______________________________________________
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