<!--
{
  "availability" : [
    "iOS: 4.0.0 - 10.0.0",
    "iPadOS: 4.0.0 - 10.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "macOS: 10.7.0 - 10.15.0"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVCaptureStillImageOutput/captureStillImageAsynchronously(from:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "c:objc(cs)AVCaptureStillImageOutput(im)captureStillImageAsynchronouslyFromConnection:completionHandler:"
  },
  "title" : "captureStillImageAsynchronously(from:completionHandler:)"
}
-->

# captureStillImageAsynchronously(from:completionHandler:)

Initiates a still image capture and returns immediately.

```
func captureStillImageAsynchronously(from connection: AVCaptureConnection, completionHandler handler: @escaping (CMSampleBuffer?, (any Error)?) -> Void)
```

## Parameters

`connection`

The connection from which to capture the image.

`handler`

A block to invoke after the image has been captured. The block parameters are as follows:

- imageDataSampleBuffer: The data that was captured.

    The buffer attachments may contain metadata appropriate to the image data format. For example, a buffer containing JPEG data may carry a     <doc://com.apple.documentation/documentation/ImageIO/kCGImagePropertyExifDictionary>     as an attachment. See ImageIO/CGImageProperties.h for a list of keys and value types.

- error: If the request could not be completed, an `NSError` object that describes the problem; otherwise `nil`.

## Discussion

This method returns immediately after it is invoked, later calling the provided completion handler block when image data is ready. If the request could not be completed, the error parameter will contain an `NSError` object describing the failure.

You should not assume that the completion handler will be called on a specific thread.

---

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)