UIDocument.WriteContents Method

Definition

Overloads

WriteContents(NSObject, NSDictionary, NSUrl, UIDocumentSaveOperation, NSError)

Writes and ensures that the document data is written properly to the specified location in the application sandbox.

WriteContents(NSObject, NSUrl, UIDocumentSaveOperation, NSUrl, NSError)

Writes and ensures that the document data is written properly to the specified location in the application sandbox.

WriteContents(NSObject, NSDictionary, NSUrl, UIDocumentSaveOperation, NSError)

Writes and ensures that the document data is written properly to the specified location in the application sandbox.

[Foundation.Export("writeContents:andAttributes:safelyToURL:forSaveOperation:error:")]
public virtual bool WriteContents (Foundation.NSObject contents, Foundation.NSDictionary additionalFileAttributes, Foundation.NSUrl url, UIKit.UIDocumentSaveOperation saveOperation, out Foundation.NSError outError);
abstract member WriteContents : Foundation.NSObject * Foundation.NSDictionary * Foundation.NSUrl * UIKit.UIDocumentSaveOperation *  -> bool
override this.WriteContents : Foundation.NSObject * Foundation.NSDictionary * Foundation.NSUrl * UIKit.UIDocumentSaveOperation *  -> bool

Parameters

contents
NSObject

Document data that is written to the disk. If a flat file, the data is encapsulated by an NSData object, and if a package, by an NSFileWrapper object.

additionalFileAttributes
NSDictionary

Glossary of NSFileManager file attributes that are assigned to the document file.

This parameter can be null.

url
NSUrl

URL address that indicates the location of a document file.

saveOperation
UIDocumentSaveOperation

This represents a constant indicating if a document file is being written for the first time or being overwritten.

outError
NSError

When overridden, and you cannot write document data, this method return by an NSError object encapsulating all reasons that this is not possible.

Returns

YES if successful, otherwise NO.

Attributes

Remarks

This can be used from a background thread.

Applies to

WriteContents(NSObject, NSUrl, UIDocumentSaveOperation, NSUrl, NSError)

Writes and ensures that the document data is written properly to the specified location in the application sandbox.

[Foundation.Export("writeContents:toURL:forSaveOperation:originalContentsURL:error:")]
public virtual bool WriteContents (Foundation.NSObject contents, Foundation.NSUrl toUrl, UIKit.UIDocumentSaveOperation saveOperation, Foundation.NSUrl originalContentsURL, out Foundation.NSError outError);
abstract member WriteContents : Foundation.NSObject * Foundation.NSUrl * UIKit.UIDocumentSaveOperation * Foundation.NSUrl *  -> bool
override this.WriteContents : Foundation.NSObject * Foundation.NSUrl * UIKit.UIDocumentSaveOperation * Foundation.NSUrl *  -> bool

Parameters

contents
NSObject

Document data that is written to the disk. If a flat file, the data is encapsulated by an NSData object, and if a package, by an NSFileWrapper object.

toUrl
NSUrl

URL that indicates the location of a document file.

saveOperation
UIDocumentSaveOperation

This represents a constant indicating if a document file is being written for the first time or being overwritten.

originalContentsURL
NSUrl

URL that specifies the prior location of the document file when it does not return null.

This parameter can be null.

outError
NSError

When overridden, and you cannot write document data, this method return by an NSError object encapsulating all reasons that this is not possible.

Returns

YES if successful, otherwise NO.

Attributes

Remarks

This can be used from a background thread.

Applies to