Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSFilePresenterMBS class.

NSFilePresenterMBS.accommodatePresentedItemDeletionWithCompletionHandler(Complete as NSFilePresenterHandlerMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells your object that its presented item is about to be deleted.

Complete: The complete handler object to call after updating your data structures. Pass nil to the run method's errorOrNil parameter if you were able to successfully prepare for the deletion of the item. Pass an error object if your object could not prepare itself properly.

A file coordinator calls this method when your object's presented item is about to be deleted. You can use this method to perform any actions that are needed to prepare for the deletion. For example, document objects typically use this method to close the document.

Important: If you implement this method, you must execute the run method in the complete parameter at the end of your implementation. The system waits for you to execute that method before allowing the other object to delete the file or directory. Therefore, failure to execute the method could stall threads in your application or other processes.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.accommodatePresentedSubitemDeletionAtURL(URL as string, file as FolderItem, Complete as NSFilePresenterHandlerMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that some entity wants to delete an item that is inside of a presented directory. (required)

url: The URL of the item being deleted from the presented directory. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.
file: URL as folderitem.
complete: The complete handler object to call after updating your data structures. Pass nil to the run method's errorOrNil parameter if you were able to successfully prepare for the deletion of the item. Pass an error object if your object could not prepare itself properly.

This method is relevant for applications that present directories. This might occur if the delegate manages the contents of a directory or manages a file that is implemented as a file package. When called, your implementation of this method should take whatever actions needed to update your application to handle the deletion of the specified file.

Important: If you implement this method, you must execute the run method in the Complete parameter at the end of your implementation. The system waits for you to execute that method before allowing the other object to delete the item at the specified URL. Therefore, failure to execute the method could stall threads in your application or in other processes.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.presentedItemDidChange

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No
This event is called when the item changed.

Be notified that the file or file package's contents or attributes have been been written to. Because this method may be be invoked when the attributes have changed but the contents have not, implementations that read the contents must use modification date checking to avoid needless rereading. They should check that the modification date has changed since the receiver most recently read from or wrote to the item. To avoid race conditions, getting the modification date should typically be done within invocations of one of the NSFileCoordinatorMBS.coordinate... methods.

For example, NSDocument implements this method to react to both contents changes (like the user overwriting the document file with another application) and attribute changes (like the user toggling the "Hide extension" checkbox in a Finder info panel). It uses modification date checking as described above.

Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent relinquishPresentedItemToWriter first. Make your application do the best it can in that case.

NSFilePresenterMBS.presentedItemDidGainVersion(version as NSFileVersionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No
Be notified that something in the system has added a version of the file or file package.

NSFilePresenterMBS.presentedItemDidLoseVersion(version as NSFileVersionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No
Be notified that something in the system has removed a version of the file or file package.

NSFilePresenterMBS.presentedItemDidMoveToURL(url as string, file as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No
Be notified that the file or directory has been moved or renamed, or a directory containing it has been moved or renamed.

A typical implementation of this method will cause subsequent invocations of presentedItemURL to return the new URL.

The new URL may have a different file name extension than the current value of the presentedItemURL property.

For example, NSDocument implements this method to handle document file moving and renaming. A shoebox application would only implement this method to be robust against surprising things like the user moving its data directory while the application is running.

Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent relinquishPresentedItemToWriter first. Make your application do the best it can in that case.

NSFilePresenterMBS.presentedItemDidResolveConflictVersion(version as NSFileVersionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No
Be notified that something in the system has resolved a version of the file or file package.

NSFilePresenterMBS.presentedItemURL as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No
The URL that locates the file or directory that the receiver is presenting to the user.

Implementations of this method must be prepared to be invoked by Cocoa in any queue, at any time, including from within invocations of NSFileCoordinator methods. A nil value is valid and means that the presented item does not exist yet. An NSFilePresenter with a nil presentedItemURL will be asked for its presentedItemURL again when coordinated file access on behalf of that NSFilePresenter completes, in case the presented item was just created.

For example, NSDocument has a -presentedItemURL method that usually returns self.fileURL. In a shoebox application that stores the user's data in files somewhere on the user's computer you can implement this method to specify the directory that contains those files.

NSFilePresenterMBS.presentedSubitemAtURLdidGainVersion(URL as string, file as FolderItem, version as NSFileVersionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that the item inside the presented directory gained a new version. (required)

url: The URL of the item inside the presented directory that gained a new version. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.
file: url as folderitem.
version: The file version object containing information about the new file version.

Your delegate can use this method to determine how to incorporate data from the new version of the item. This might involve incorporating the version silently or asking the user about how to proceed.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.presentedSubitemAtURLdidLoseVersion(URL as string, file as FolderItem, version as NSFileVersionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that the item inside the presented directory lost an existing version. (required)

url: The URL of the item inside the presented directory that lost a version. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.
file: URL as folderitem.
version: The file version object containing information about the version that was removed.

Your delegate can use this method to determine how to handle the loss of the specified file version. For an old version, you might not have to do anything. However, if your application is currently using the lost version, you would need to update your application's user interface or prompt the user about how to proceed.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.presentedSubitemAtURLdidMoveToURL(oldURL as string, newURL as string, oldFile as folderitem, newFile as folderitem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that an item in the presented directory moved to a new location. (required)

oldURL: The original URL of the item inside the presented directory. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.
newURL: The new URL for the item. This URL may or may not be located inside the presented directory.
oldFile: oldURL as folderitem.
newFile: newURL as folderitem.

This method is relevant for applications that present directories. This might occur if the delegate manages the contents of a directory or manages a file that is implemented as a file package. Your implementation of this method should take whatever actions necessary to handle the change in location of the specified item. For example, you might update references to the item in your application's data structures and refresh your user interface.

If the presented directory is a file package, the system calls the presentedItemDidChange method if your delegate does not implement this method.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.presentedSubitemAtURLdidResolveConflictVersion(URL as string, file as FolderItem, version as NSFileVersionMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that the item inside the presented directory had a version conflict resolved by an outside entity. (required)

url: The URL of the item inside the presented directory that was in conflict. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.
file: URL as folderitem.
version: The version object containing the conflicting change.

Your delegate can use this method to respond to the resolution of a version conflict by a different file presenter. This might occur if a version of your application running on another device resolves the conflict first. You might then use this method to update your user interface to indicate that there is no longer a conflict.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.presentedSubitemDidAppearAtURL(URL as string, file as FolderItem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that an item was added to the presented directory. (required)

url: The URL of the item being added to the presented directory. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.
file: URL as a folderitem.

This method is relevant for applications that present directories. This might occur if the delegate manages the contents of a directory or manages a file that is implemented as a file package. Your implementation of this method should take whatever actions necessary to incorporate the new file or directory into the presented content. For example, you might add the new item to your application's data structures and refresh your user interface.

If the presented directory is a file package, the system calls the presentedItemDidChange method if your delegate does not implement this method.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.presentedSubitemDidChangeAtURL(URL as string, file as FolderItem)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells the delegate that the contents or attributes of the specified item changed. (required)

url: The URL of the item in the presented directory that changed. The item need not be at the top level of the presented directory but may itself be inside a nested subdirectory.

This method is relevant for applications that present directories. This might occur if the delegate manages the contents of a directory or manages a file that is implemented as a file package. Your implementation of this method should take whatever actions necessary to handle the change in content or attributes of the specified item.

If the presented directory is a file package, the system calls the presentedItemDidChange method if your delegate does not implement this method.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.primaryPresentedItemURL as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No
The URL of a secondary item's primary presented file or directory. (read-only)

This property supports App Sandbox in OS X.

Some apps require access to secondary files or directories with names that are related to the primary, user-selected file. For example, a subtitle file, by convention, has the same name as its corresponding movie file, but with a different filename extension. If a movie player is sandboxed, an NSOpenPanel object will grant access only to the user-selected movie file (the primary item) and not its associated subtitle file (the secondary item).

To gain access to a secondary item, first register an NSFilePresenter object for it. At any point in its existence, a secondary item must be able to return an NSURL object to its primary item. This is done by using this property. When done accessing the secondary item, unregister the file presenter object.

Available in OS X v10.8 and later.

NSFilePresenterMBS.reacquirer

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
The reacquirer event.

Called when you can reacquire an object.
e.g. called by relinquishPresentedItemToReader method.

NSFilePresenterMBS.relinquishPresentedItemToReader(reader as NSFilePresenterHandlerMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Notifies your object that another object or process wants to read the presented file or directory.

reader: A handler object. The reacquirer event is called to notify when the reader is done. If your object does not need to be notified, it can pass nil for the reacquirer block.

You use this method to provide an appropriate response when another object wants to read from your presented URL. For example, when this method is called, you might temporarily stop making changes to the file or directory. After taking any appropriate steps, you must execute the block in the reader parameter to let the waiting object know that it may now proceed with its task. If you want to be notified when the reader has completed its task, pass your own block to the reader and use that block to reacquire the file or URL for your own uses.

Important: If you implement this method, you must execute the run method in the reader parameter as part of your implementation. The system waits for you to execute that method before allowing the reader to operate on the file. Therefore, failure to execute the method could stall threads in your application or other processes until the user takes corrective actions.

Your implementation of this method is executed using the queue in the presentedItemOperationQueue property. Your reacquirer event is executed on the queue associated with the reader.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.relinquishPresentedItemToWriter(writer as NSFilePresenterHandlerMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Notifies your object that another object or process wants to write to the presented file or directory.

writer: A complete handler object. The reacquirer event is called so that your object can be notified when the writer is done.

You use this method to provide an appropriate response when another object wants to write to your presented URL. For example, when this method is called, you would likely stop making changes to the file or directory. After taking any appropriate steps, you must execute the run method in the writer parameter to let the waiting object know that it may now proceed with its task.

Important: If you implement this method, you must execute the run method in the writer parameter at the end of your implementation. The system waits for you to execute that block before allowing the writer to operate on the file. Therefore, failure to execute the run method could stall threads in your application or other processes.
If the writer changes the file or directory, you do not need to incorporate those changes in your reacquirer block. Instead, implement the presentedItemDidChange method and use it to detect when a writer actually wrote its changes to disk.

Your implementation of this method is executed using the queue in the presentedItemOperationQueue property. Your reacquirer event is executed on the queue associated with the writer.

Available in Mac OS X v10.7 and later.

NSFilePresenterMBS.savePresentedItemChangesWithCompletionHandler(Complete as NSFilePresenterHandlerMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event iCloud MBS MacCloud Plugin 11.3 ✅ Yes ❌ No ❌ No ❌ No
Tells your object to save any unsaved changes for the presented item.

Complete: The handler object to call after you save your changes. If you saved your changes successfully, pass nil for the run's errorOrNil parameter; otherwise, pass an error object indicating why the changes could not be saved.

The file coordinator calls this method to ensure that all objects trying to access the file or directory see the same contents. Implement this method if your object can change the presented item in a way that requires you to write those changes back to disk. If your presenter object does not make changes that need to be saved, you do not need to implement this method.

Important: If you implement this method, you must execute the run method in the Complete parameter at the end of your implementation. The system waits for you to execute that block before allowing other objects to operate on the file. Therefore, failure to execute the run method could stall threads in your application or other processes.

Available in Mac OS X v10.7 and later.

The items on this page are in the following plugins: MBS MacCloud Plugin.


The biggest plugin in space...