On May 1, 2015, at 14:02:27, Sean McBride <[email protected]> wrote:
> 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. :(
What happens with the doc after initWithTemplate? Are standard document or doc
controller methods acting on it? Try overriding setFileURL: (or just set a
symbolic breakpoint on it) so you can see if something is setting the url after
your initWithTemplate method. Or try calling setFileURL before readFromURL.
--
Steve Mills
Drummer, Mac geek
_______________________________________________
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]