<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.2.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSURLConnection/cancel()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLConnection(im)cancel"
  },
  "title" : "cancel()"
}
-->

# cancel()

Cancels an asynchronous load of a request.

```
func cancel()
```

## Discussion

After this method is called, the connection makes no further delegate method calls. If you want to reattempt the connection, you should create a new connection object.

## See Also

[`+  connectionWithRequest:delegate:`](/documentation/Foundation/NSURLConnection/connectionWithRequest:delegate:)

Creates and returns an initialized URL connection and begins to load the data for the URL request.

[`-  initWithRequest:delegate:`](/documentation/Foundation/NSURLConnection/init(request:delegate:))

Returns an initialized URL connection and begins to load the data for the URL request.



---

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)