---
title: "SecTaskCreateWithAuditToken(_:_:)"
framework: security
role: symbol
role_heading: Function
path: "security/sectaskcreatewithaudittoken(_:_:)"
---

# SecTaskCreateWithAuditToken(_:_:)

Creates a task object for the task that sent the Mach message represented by the audit token.

## Declaration

```swift
func SecTaskCreateWithAuditToken(_ allocator: CFAllocator?, _ token: audit_token_t) -> SecTask?
```

## Parameters

- `allocator`: An allocator. Pass NULL to use the default.
- `token`: The audit token of a Mach message.

## Return Value

Return Value A new task, or NULL on error. In Objective-C, call the CFRelease function to free this task’s memory when you are done with it.
