---
title: "MIDIObjectFindByUniqueID(_:_:_:)"
framework: coremidi
role: symbol
role_heading: Function
path: "coremidi/midiobjectfindbyuniqueid(_:_:_:)"
---

# MIDIObjectFindByUniqueID(_:_:_:)

Locates a device, entity, or endpoint by its unique identifier.

## Declaration

```swift
func MIDIObjectFindByUniqueID(_ inUniqueID: MIDIUniqueID, _ outObject: UnsafeMutablePointer<MIDIObjectRef>?, _ outObjectType: UnsafeMutablePointer<MIDIObjectType>?) -> OSStatus
```

## Parameters

- `inUniqueID`: The unique ID of the object to search for. You determine the unique ID by querying doc://com.apple.coremidi/documentation/CoreMIDI/MIDIObjectGetIntegerProperty(_:_:_:) for the doc://com.apple.coremidi/documentation/CoreMIDI/kMIDIPropertyUniqueID property.
- `outObject`: The returned object, or 0 if the object wasn’t found or an error occurred. Cast this pointer to the appropriate type, according to type specified by the outObjectType argument.
- `outObjectType`: On exit, the type of object found, or undefined if the system found no objects.

## Return Value

Return Value An OSStatus error code, including kMIDIObjectNotFound if there is no object with this unique ID.

## Topics

### Parameter Types

- [MIDIUniqueID](coremidi/midiuniqueid.md)
- [kMIDIInvalidUniqueID](coremidi/kmidiinvaliduniqueid.md)
- [MIDIObjectType](coremidi/midiobjecttype.md)

## See Also

### MIDI object configuration

- [MIDIObjectRef](coremidi/midiobjectref.md)
- [MIDI Object Properties](coremidi/midi-object-properties.md)
