<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 18.2.0 -",
    "macOS: 12.3.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ScreenCaptureKit",
  "identifier" : "/documentation/ScreenCaptureKit/SCStreamDelegate/stream(_:didStopWithError:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "ScreenCaptureKit"
    ],
    "preciseIdentifier" : "c:objc(pl)SCStreamDelegate(im)stream:didStopWithError:"
  },
  "title" : "stream(_:didStopWithError:)"
}
-->

# stream(_:didStopWithError:)

Tells the delegate that the stream stopped with an error.

```
optional func stream(_ stream: SCStream, didStopWithError error: any Error)
```

## Parameters

`stream`

The stream that stopped.

`error`

The error that caused the stream stoppage.

## Discussion> Note:
> When the `error` parameter has the code ``doc://com.apple.screencapturekit/documentation/ScreenCaptureKit/SCStreamError/Code/userStopped``, the user took an intentional action to cancel the stream. Treat errors of this type as expected and recoverable failures.

---

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)