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

# stop()

Halts a currently running attempt to publish or resolve a service.

```
func stop()
```

## Discussion

The delegate will receive [`netServiceDidStop(_:)`](/documentation/Foundation/NetServiceDelegate/netServiceDidStop(_:)) after the service stops.

It is safe to remove all strong references to the service immediately after calling [`stop()`](/documentation/Foundation/NetService/stop()).

---

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)