---
title: getObject
framework: Kernel
role: symbol
role_heading: Instance Method
platforms: [driverkit 19.0+, macOS 10.15.2+]
path: kernel/osdictionary/3433846-getobject
---

# getObject

Returns a member of the dictionary.

## Declaration

```occ
OSObject * getObject(const char *aKey);
```

```occ
virtual OSObject * getObject(const char *aKey);
```

## Parameters

- `aKey`: A c-string key. An OSString is created from aKey and used as the key for the dictionary.

## Return Value

Return Value Member at the given index or NULL if the index is greater or equal to the array count. The retain count of the result object is not incremented and the object should not be release by the caller.

## Discussion

Discussion Looks up an existing object in the dictionary with the given key and returns it.

## See Also

### Accessing Keys and Values

- [getObject](kernel/osdictionary/3180901-getobject.md)
- [setObject](kernel/osdictionary/3180906-setobject.md)
- [setObject](kernel/osdictionary/3433850-setobject.md)
- [removeObject](kernel/osdictionary/3180905-removeobject.md)
- [removeObject](kernel/osdictionary/3433849-removeobject.md)
- [iterateObjects](driverkit/osdictionary/iterateobjects-9h89s.md)
- [iterateObjects](driverkit/osdictionary/iterateobjects-6cv0d.md)
- [OSDictionaryIterateObjectsBlock](driverkit/osdictionaryiterateobjectsblock.md)
- [OSDictionaryIterateObjectsCallback](driverkit/osdictionaryiterateobjectscallback.md)
