Re: Saving while opening with NSDocument
Re: Saving while opening with NSDocument
- Subject: Re: Saving while opening with NSDocument
- From: Kyle Sluder <email@hidden>
- Date: Wed, 19 Mar 2014 09:52:22 -0700
> On Mar 19, 2014, at 9:43 AM, Quincey Morris <email@hidden> wrote:
>
>> On Mar 19, 2014, at 04:30 , Colas B <email@hidden> wrote:
>>
>> I will look in the direction of ‘performSelector’ if (when) I want to save these initial data repairings. Another possible issue might be that the delay is not long enough and the `saveDocument:` creates a deadlock. This is an unlikely situation if the delay is 10 seconds. Is there a way to detect when we are in such a situation?
>
> I’d suggest you do it (with a delay of 0) in an override of -[NSDocument windowControllerDidLoadNib:]. At that point, the NSDocument initialization process is basically over, as is the work of opening the document window (which likely involves disk accesses to read the NIB file).
This doesn’t sound like a good idea to me. There is no guarantee that opening an NSDocument will cause it to create an interface—see AppleScript, printing from the Finder’s contextual menu, etc.
A much more appropriate place to do this would be in a subclass of NSDocumentController.
--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