---
title: "broadcastController(_:didFinishWithError:)"
framework: replaykit
role: symbol
role_heading: Instance Method
path: "replaykit/rpbroadcastcontrollerdelegate/broadcastcontroller(_:didfinishwitherror:)"
---

# broadcastController(_:didFinishWithError:)

Tells the delegate that a broadcast ended due to an error.

## Declaration

```swift
optional func broadcastController(_ broadcastController: RPBroadcastController, didFinishWithError error: (any Error)?)
```

## Parameters

- `broadcastController`: The current controller instance.
- `error`: An doc://com.apple.replaykit/documentation/ReplayKit/RPRecordingErrorCode error indicating why the broadcast finished.

## Discussion

Discussion Use the returned error to inform the user why the broadcast failed and provide an option to resume the broadcast, if applicable.
