Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?
Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?
- Subject: Re: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?
- From: Trygve Inda <email@hidden>
- Date: Sun, 20 Apr 2014 13:01:05 -0700
- Thread-topic: canAsynchronouslyWriteToURL:ofType:forSaveOperation: Prevent Quit?
>
> On 20 Apr 2014, at 19:58, Trygve Inda <email@hidden> wrote:
>
>> I return YES from
>>
>> canAsynchronouslyWriteToURL:ofType:forSaveOperation:
>>
>> Which works fine, but the user is able to quit the app while the save is in
>> progress. Is there way way to know when the save is complete so that I can
>> prevent quit before the save ends?
>
> If you play by NSDocument’s rules, the won’t actually terminate until saving
> is finished. How have you determined that this is not the case for your app?
> Is your save process doing anything weird?
>
>
If I start a save and quit immediately, the file is not written. In my
Document class I override:
-(NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError
**)outError
{
if ([self documentFileWrapper] == nil)
[self setDocumentFileWrapper:[self createPackageDirectoryStructure]];
...
[self unblockUserInteraction];
return documentFileWrapper;
}
-(BOOL)canAsynchronouslyWriteToURL:(NSURL *)url ofType:(NSString *)typeName
forSaveOperation:(NSSaveOperationType)saveOperation
{
return YES;
}
_______________________________________________
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