Mac Developer Library

Developer

ScriptingBridge Framework Reference SBApplicationDelegate Protocol Reference

Options
Deployment Target:

On This Page
Language:

SBApplicationDelegate

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import ScriptingBridge

Objective-C

@import ScriptingBridge;

Availability


Available in OS X v10.6 and later.

This informal protocol defines a delegation method for handling Apple event errors that are sent from an target application to an SBApplication object.

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

  • Sent by an SBApplication object when a target application returns an error Apple event. (required)

    Declaration

    Swift

    func eventDidFail(_ event: UnsafePointer<AppleEvent>, withError error: NSError!) -> AnyObject!

    Objective-C

    - (id)eventDidFail:(const AppleEvent *)event withError:(NSError *)error

    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. See “User Info Dictionary Keys” for a list of possible keys for this dictionary.

    Return Value

    If you return a result, it will become the result of the sendEvent: that failed. Can be nil.

    Import Statement

    Objective-C

    @import ScriptingBridge;

    Swift

    import ScriptingBridge

    Availability

    Available in OS X v10.5 and later.

    Available as part of an informal protocol prior to OS X v10.6.

  • The following describes the possible keys for the userInfo dictionary of the NSError object passed to the delegate. Note that for some errors, the userInfo dictionary may not have any of these keys.

    Declaration

    Objective-C

    Constants

    • @"ErrorBriefMessage"

      @"ErrorBriefMessage"

      A short human-readable description of the error, as an NSString object.

    • @"ErrorExpectedType"

      @"ErrorExpectedType"

      The type of data the target application expected, as an NSAppleEventDescriptor object.

    • @"ErrorOffendingObject"

      @"ErrorOffendingObject"

      The object that caused the error.

    • @"ErrorString"

      @"ErrorString"

      A full human-readable description of the error, as an NSString object.

    • @"ErrorNumber"

      @"ErrorNumber"

      The Apple event error number, as an NSNumber object.