---
title: "AECallObjectAccessor(_:_:_:_:_:_:)"
framework: coreservices
role: symbol
role_heading: Function
path: coreservices/1447059-aecallobjectaccessor
---

# AECallObjectAccessor(_:_:_:_:_:_:)

Invokes the appropriate object accessor function for a specific desired type and container type.

## Declaration

```swift
func AECallObjectAccessor(_ desiredClass: DescType, _ containerToken: UnsafePointer<AEDesc>!, _ containerClass: DescType, _ keyForm: DescType, _ keyData: UnsafePointer<AEDesc>!, _ token: UnsafeMutablePointer<AEDesc>!) -> OSErr
```

## Parameters

- `desiredClass`: The type of the Apple event object requested. Some possible values are defined in doc://com.apple.documentation/documentation/coreservices/apple_events/1556368-object_class_id_constants. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `containerToken`: A pointer to the token that identifies the container for the desired object. (Token is defined in doc://com.apple.documentation/documentation/coreservices/1446783-aedisposetoken.) See doc://com.apple.documentation/documentation/coreservices/aedesc.
- `containerClass`: The object class of the container for the desired objects. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `keyForm`: The key form that specifies how to find the object within the container. Key form constants are described in doc://com.apple.documentation/documentation/coreservices/apple_events/1572731-key_form_and_descriptor_type_obj. See doc://com.apple.documentation/documentation/coreservices/desctype.
- `keyData`: A pointer to the key data that identifies the object within the container. The type of this data is form-specific. That is, formName typically has key data of type typeText. See doc://com.apple.documentation/documentation/coreservices/aedesc.
- `token`: A pointer to a token. On return, a token specifying the desired object (or objects). Your application should dispose of this token when it is through with it by calling doc://com.apple.documentation/documentation/coreservices/1446783-aedisposetoken. See doc://com.apple.documentation/documentation/coreservices/aedesc.

## Return Value

Return Value A result code. See Result Codes. AECallObjectAccessor returns any result codes returned by the object accessor function it calls.

## Discussion

Discussion If you want your application to do some of the Apple event object resolution normally performed by the AEResolve(_:_:_:) function, you can use AECallObjectAccessor to invoke an object accessor function. This might be useful, for example, if you have installed an object accessor function using typeWildCard for the AEInstallObjectAccessor function’s desiredClass parameter and typeAEList for the containerType parameter. To return a list of tokens for a request like “line one of every window” the object accessor function can create an empty list, then call AECallObjectAccessor for each requested element, adding tokens for each element to the list one at a time. The parameters of AECallObjectAccessor are identical to the parameters of an object accessor function, as described in OSLAccessorProcPtr with one exception—the Apple Event Manager adds a reference constant parameter each time it calls the object accessor function. You can also call a specific object accessor function directly through its universal procedure pointer with one of the invoke functions described in Creating, Calling, and Deleting Universal Procedure Pointers.  Version-Notes In macOS, your application can not make an object callback function available to other applications by installing it in a system object accessor dispatch table.

## See Also

### Getting, Calling, and Removing Object Accessor Functions

- [AEGetObjectAccessor(_:_:_:_:_:)](coreservices/1449054-aegetobjectaccessor.md)
- [AEInstallObjectAccessor(_:_:_:_:_:)](coreservices/1447905-aeinstallobjectaccessor.md)
- [AERemoveObjectAccessor(_:_:_:_:)](coreservices/1442552-aeremoveobjectaccessor.md)
