---
title: "connection(_:didCancel:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/nsurlconnectiondelegate/connection(_:didcancel:)"
---

# connection(_:didCancel:)

Sent when a connection cancels an authentication challenge.

## Declaration

```swift
optional func connection(_ connection: NSURLConnection, didCancel challenge: URLAuthenticationChallenge)
```

## Parameters

- `connection`: The connection sending the message.
- `challenge`: The challenge that was canceled.

## See Also

### Connection Authentication

- [connection(_:willSendRequestFor:)](foundation/nsurlconnectiondelegate/connection(_:willsendrequestfor:).md)
- [connection(_:canAuthenticateAgainstProtectionSpace:)](foundation/nsurlconnectiondelegate/connection(_:canauthenticateagainstprotectionspace:).md)
- [connection(_:didReceive:)](foundation/nsurlconnectiondelegate/connection(_:didreceive:).md)
- [connectionShouldUseCredentialStorage(_:)](foundation/nsurlconnectiondelegate/connectionshouldusecredentialstorage(_:).md)
