<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Security",
  "identifier" : "/documentation/Security/SecTaskCreateFromSelf(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Security"
    ],
    "preciseIdentifier" : "c:@F@SecTaskCreateFromSelf"
  },
  "title" : "SecTaskCreateFromSelf(_:)"
}
-->

# SecTaskCreateFromSelf(_:)

Creates a task object for the current task.

```
func SecTaskCreateFromSelf(_ allocator: CFAllocator?) -> SecTask?
```

## Parameters

`allocator`

An allocator. Pass `NULL` to use the default.

## Return Value

A new task, or `NULL` on error. In Objective-C, call the <doc://com.apple.documentation/documentation/CoreFoundation/CFRelease> function to free this task’s memory when you are done with it.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)