---
title: "cancelDataRequest(_:)"
framework: photos
role: symbol
role_heading: Instance Method
path: "photos/phassetresourcemanager/canceldatarequest(_:)"
---

# cancelDataRequest(_:)

Cancels an asynchronous request.

## Declaration

```swift
func cancelDataRequest(_ requestID: PHAssetResourceDataRequestID)
```

## Parameters

- `requestID`: The numeric identifier of the request to be canceled.

## Discussion

Discussion When you perform an asynchronous request for asset resource data using the requestData(for:options:dataReceivedHandler:completionHandler:) method, the image manager returns a numeric identifier for the request. To cancel the request before it completes, provide this identifier when calling the cancelDataRequest(_:) method.

## See Also

### Requesting Resources

- [requestData(for:options:dataReceivedHandler:completionHandler:)](photos/phassetresourcemanager/requestdata(for:options:datareceivedhandler:completionhandler:).md)
- [writeData(for:toFile:options:completionHandler:)](photos/phassetresourcemanager/writedata(for:tofile:options:completionhandler:).md)
