Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSApplicationDelegateMBS class.

Previous items

NSApplicationDelegateMBS.restoreWindowWithIdentifier(identifier as string, state as NSCoderMBS, byref resultWindow as Variant, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa MBS MacCocoa Plugin 13.2 ✅ Yes ❌ No ❌ No ❌ No
Invoked to request that a window be restored.

If you plan to use this event, please initialize the NSApplicationDelegateMBS subclass in app.constructor.

identifier: The unique interface item identifier string that was previously associated with the window. Use this string to determine which window to create.
state: A NSCoderMBS object containing the window state information. This coder object contains the combined restorable state of the window, which can include the state of the window, its delegate, window controller, and document object. You can use this state to determine which window to create.

Pass back with the parameters:
The window that was created or nil if the window could not be created.
An error object if the window was not recognized or could not be created for whatever reason; otherwise, specify nil. In OS X 10.7, the error parameter is ignored.

Return true if the window was restored; otherwise false.

If the receiver knows how to restore the identified window, it should invoke the completion handler with the window, possibly creating it. It is acceptable to use a pre-existing window, though you should not pass the same window to more than one completion handler. If the receiver cannot restore the identified window (for example, the window referenced a document that has been deleted), it should invoke the completion handler with a nil window.

The receiver is application is passed the identifier of the window, which allows it to quickly check for known windows. For example, you might give your preferences window an identifier of "preferences" in the nib, and then check for that identifier in your implementation. The receiver is also passed the NSCoder instance containing the combined restorable state of the window, its delegate, the window controller, and any document. The receiver may decode information previously stored in the coder to determine what window to restore.

Available in OS X v10.7 and later.

The plugin implements this method for NSApplication and forwards the message to this event.
If you return true, please set either error or resultWindow values. resultWindow must be an NSWindowMBS or a window object.

Some examples using this event:

NSApplicationDelegateMBS.userDidAcceptCloudKitShareWithMetadata(metadata as Variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
event Cocoa MBS MacCocoa Plugin 21.2 ✅ Yes ❌ No ❌ No ❌ No
Tells you that the app has access to shared information in CloudKit.
Example
// sample implementation of the event:

Sub userDidAcceptCloudKitShareWithMetadata(metadata as Variant) Handles userDidAcceptCloudKitShareWithMetadata
Dim c As CKShareMetadataMBS = metadata

Message "User did accept CloudKit share: "+c.containerIdentifier
End Sub

metadata is a CKShareMetadataMBS class.

metdata: Information about the CloudKit data that is available to the app. Use this object to retrieve information about the CKShare object and the associated records that are available.

Use this method to respond to a CloudKit Sharing invitation. In your implementation, accept the share by scheduling a CKAcceptSharesOperationMBS object that contains the provided metadata object. After the user accepts the share, you can begin fetching records and incorporating the resulting data into your app.
The system launches the app, as necessary, before calling this method.

Previous items

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


💬 Ask a question or report a problem
The biggest plugin in space...