SBApplicationDelegate

Trait SBApplicationDelegate 

Source
pub unsafe trait SBApplicationDelegate {
    // Provided method
    unsafe fn eventDidFail_withError(
        &self,
        event: NonNull<AppleEvent>,
        error: &NSError,
    ) -> Option<Retained<AnyObject>>
       where Self: Sized + Message { ... }
}
Available on crate feature SBApplication only.
Expand description

This informal protocol defines a delegation method for handling Apple event errors that are sent from a target application to an <doc ://com.apple.documentation/documentation/scriptingbridge/sbapplication> object.

You must set a delegate for the SBApplication object using the SBApplication/delegate method. If you do not set a delegate and have the delegate handle the error in some way, SBApplication raises an exception.

See also Apple’s documentation

Provided Methods§

Source

unsafe fn eventDidFail_withError( &self, event: NonNull<AppleEvent>, error: &NSError, ) -> Option<Retained<AnyObject>>
where Self: Sized + Message,

Available on crate feature objc2-core-services only.

Sent by an SBApplication object when a target application returns an error Apple event.

  • Parameters:

  • event: A pointer to the Apple event sent to the target application causing the error.

  • error: An object containing information about the error Apple event. Specific information may be included in the useInfo dictionary of the error object. The following table shows the possible keys for this dictionary.

KeyDescription
ErrorBriefMessageA short human-readable description of the error, as an
<doc
://com.apple.documentation/documentation/foundation/nsstring>
ErrorExpectedTypeThe type of data the target application expected, as an
<doc
://com.apple.documentation/documentation/foundation/nsappleeventdescriptor> object.
ErrorOffendingObjectThe object that caused the error.
ErrorStringA full human-readable description of the error, as an
<doc
://com.apple.documentation/documentation/foundation/nsstring> object.
ErrorNumberThe Apple event error number, as an
<doc
://com.apple.documentation/documentation/foundation/nsnumber> object.
  • Returns: If you return a result, it will become the result of the <doc ://com.apple.documentation/documentation/appkit/nsapplication/1428359-sendevent> that failed. Can be nil.
§Safety

event must be a valid pointer.

Trait Implementations§

Source§

impl ProtocolType for dyn SBApplicationDelegate

Source§

const NAME: &'static str = "SBApplicationDelegate"

The name of the Objective-C protocol that this type represents. Read more
Source§

fn protocol() -> Option<&'static AnyProtocol>

Get a reference to the Objective-C protocol object that this type represents. Read more
Source§

impl<T> ImplementedBy<T> for dyn SBApplicationDelegate

Implementations on Foreign Types§

Source§

impl<T> SBApplicationDelegate for ProtocolObject<T>

Implementors§