On Fri, 1 May 2015 13:36:49 -0500, Steve Mills said:
>Can’t you just set the document’s url to nil at some point? That’s what
>I do in readFromURL:ofType:error: after reading the file (actually
>before reading, because I don’t access the url again from the document).
>I’m using regular NSDocument, but I’d still expect it to work with
>NSPersistentDocument.
Steve,
Thanks for your reply.
Seems that does not help.
In my NSPersistentDocument subclass I created a new initializer, which stripped
of error checking, is basically:
- (instancetype)initWithTemplate
{
self = [super init];
[self readFromURL:<hidden file in my .app>
ofType:@"com.rogue-research.foobar"
error:&error];
[self setFileURL:nil]; // seems to change nothing
return self;
}
Indeed I get what looks like a new/untitled document and it has the correct
contents from the template file. When I save I get a save panel and supply a
filename for example on the Desktop but then it tries to save to my template
anyway with an exception:
NSUnderlyingException = "Cannot update objects into a read only store.";
readFromURL: seems to have added my template as a persistent store in the
persistent store coordinator. :(
Cheers,
--
____________________________________________________________
Sean McBride, B. Eng [email protected]
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]