Try returning nil for the document in [NSDocumentController 
reopenDocumentForURL::::]’s completion handler, and also return the following 
error in the completion handler:

[NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError 
userInfo:nil]

On Feb 13, 2014, at 6:57 PM, Mike Abdullah <mabdul...@karelia.com> wrote:

> 
> On 13 Feb 2014, at 23:39, Eric Gorr <mail...@ericgorr.net> wrote:
> 
>> 
>> 
>>> On Feb 13, 2014, at 6:22 PM, Mike Abdullah <mabdul...@karelia.com> wrote:
>>> 
>>> 
>>>> On 13 Feb 2014, at 21:12, Eric Gorr <mail...@ericgorr.net> wrote:
>>>> 
>>>> What I want to do seems like it should be fairly straightforward, but 
>>>> doesn't seem to be. All I want to do is with a standard NSDocument Based 
>>>> (with Core Data) is prevent the last document opened from opening 
>>>> automatically the next time the application is launched.
>>>> 
>>>> What is the best way to accomplished this?
>>>> 
>>>> It seemed as if it might be as simple as overriding reopenDocumentForURL 
>>>> and having it do nothing, but that only seems to break creating new 
>>>> documents or opening the document normally.
>>>> 
>>>> I could probably disable all of the window restoration functionality and 
>>>> handle it all myself by using:
>>>> 
>>>> [window setRestorationClass:Nil];
>>>> [window setRestorable:NO];
>>>> [window invalidateRestorableState];
>>>> 
>>>> but this seems to be overkill and not really what I want to do as when I 
>>>> open the document via File->Open, I want it to restore without the need 
>>>> for me to handle it myself.
>>>> 
>>>> Is there some easy way to make this work?
>>>> 
>>>> The deployment target is 10.7.
>>>> 
>>>> I have a sample test project at:
>>>> 
>>>>  https://github.com/ericgorr/autoload.git
>>> 
>>> Perhaps you want to override -[NSDocumentController 
>>> reopenDocumentForURL:withContentsOfURL:display:completionHandler:]
>>> 
>> 
>> Yes, as I mentioned, I tried that, but it wasn't clear exactly what I should 
>> do. I tried to simply have it do nothing, but that broke other 
>> functionality. I tried a couple of other things as well, like passing nil to 
>> the super's method, but the app just crashed.
> 
> Oops, sorry, missed that bit of your original message.
> 
> 
> _______________________________________________
> 
> 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/dave.fernandes%40utoronto.ca
> 
> This email sent to dave.fernan...@utoronto.ca


_______________________________________________

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

Reply via email to