Saves the contents of the document to a file or file package located by a URL, formatted to a specified type, for a particular kind of save operation.
SDK
- macOS 10.4+
Framework
- App
Kit
Declaration
- (void)saveToURL:(NSURL *)url ofType:(NSString *)typeName forSaveOperation:(NSSave Operation Type)saveOperation delegate:(id)delegate didSaveSelector:(SEL)didSaveSelector contextInfo:(void *)contextInfo;
Parameters
absoluteURL
The location of the file or file package to which the document contents are saved.
typeName
The string that identifies the document type.
saveOperation
The type of save operation.
delegate
The delegate to which the selector message is sent.
didSaveSelector
The selector of the message sent to the delegate.
contextInfo
Object passed with the callback to provide any additional context information.
Discussion
When saving is completed, regardless of success or failure, the method sends the message selected by did
to the delegate
, with the context
as the last argument. The method selected by did
must have the same signature as:
- (void)document:(NSDocument *)document didSave:(BOOL)didSaveSuccessfully contextInfo:(void *)contextInfo;
The default implementation of this method invokes [self save
and, if NO
is returned, presents the error to the user in a document-modal panel before messaging the delegate.