<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/RunLoop/cancelPerform(_:target:argument:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSRunLoop(im)cancelPerformSelector:target:argument:"
  },
  "title" : "cancelPerform(_:target:argument:)"
}
-->

# cancelPerform(_:target:argument:)

Cancels the sending of a previously scheduled message.

```
func cancelPerform(_ aSelector: Selector, target: Any, argument arg: Any?)
```

## Parameters

`aSelector`

The previously-specified selector.

`target`

The previously-specified target.

`arg`

The previously-specified argument.

## Discussion

You can use this method to cancel a message previously scheduled using the [`perform(_:target:argument:order:modes:)`](/documentation/Foundation/RunLoop/perform(_:target:argument:order:modes:)) method. The parameters identify the message you want to cancel and must match those originally specified when the selector was scheduled. This method removes the perform request from all modes of the run loop.

---

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)