---
title: removeObject
framework: Kernel
role: symbol
role_heading: Instance Method
platforms: [driverkit 19.0+, macOS 10.15+]
path: kernel/osdictionary/3180905-removeobject
---

# removeObject

Remove an object by key from the dictionary.

## Declaration

```occ
void removeObject(const OSObject *aKey);
```

```occ
virtual void removeObject(const OSString *aKey);
```

## Parameters

- `aKey`: An object pointer used to lookup the object. The key should be uniqued within the dictionary. Usually an OSString is passed as the key.

## Return Value

Return Value true on success, which retains the object, or false on failure which does not retain the object.

## Discussion

Discussion An object in the dictionary with the given key object is removed and released.

## See Also

### Accessing Keys and Values

- [getObject](kernel/osdictionary/3180901-getobject.md)
- [getObject](kernel/osdictionary/3433846-getobject.md)
- [setObject](kernel/osdictionary/3180906-setobject.md)
- [setObject](kernel/osdictionary/3433850-setobject.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)
