Re: Saving while opening with NSDocument
Re: Saving while opening with NSDocument
- Subject: Re: Saving while opening with NSDocument
- From: Quincey Morris <email@hidden>
- Date: Wed, 19 Mar 2014 09:43:24 -0700
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).
Note that the point of using ‘performSelector:’ here is not to have a time delay, but to defer the performed action until the next iteration of the run loop, at which point the possibility of your deadlock no longer exists.
_______________________________________________
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