---
title: "grantCapability:error:invalidationHandler:"
framework: browserenginekit
role: symbol
role_heading: Instance Method
path: "browserenginekit/bewebcontentprocess/grantcapability:error:invalidationhandler:"
---

# grantCapability:error:invalidationHandler:

Grants the specified capability to the process, invoking the handler when the capability becomes invalid.

## Declaration

```occ
- (id<BEProcessCapabilityGrant>) grantCapability:(BEProcessCapability *) capability error:(NSError **) error invalidationHandler:(void (^)()) invalidationHandler;
```

## Parameters

- `capability`: The capability to grant.
- `error`: If an error occurs, upon return contains an doc://com.apple.documentation/documentation/Foundation/NSError object that describes the problem. If you don’t want information about errors that happen, pass in NULL.
- `invalidationHandler`: A block the system calls when the capability becomes invalid.

## Return Value

Return Value A BEProcessCapabilityGrant object that represents the granted capability, or nil if an error occurs.

## Discussion

Discussion When the process no longer needs the capability, call invalidate on the returned object.

## See Also

### Coordinating processes

- [grantCapability:error:](browserenginekit/bewebcontentprocess/grantcapability:error:.md)
- [createVisibilityPropagationInteraction](browserenginekit/bewebcontentprocess/createvisibilitypropagationinteraction.md)
