<!--
{
  "availability" : [
    "watchOS: 3.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKSnapshotRefreshBackgroundTask/setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKSnapshotRefreshBackgroundTask(im)setTaskCompletedWithDefaultStateRestored:estimatedSnapshotExpiration:userInfo:"
  },
  "title" : "setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:)"
}
-->

# setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:)

Marks the task as complete.

```
func setTaskCompleted(restoredDefaultState: Bool, estimatedSnapshotExpiration: Date?, userInfo: (any NSSecureCoding & NSObjectProtocol)?)
```

## Parameters

`restoredDefaultState`

Pass <doc://com.apple.documentation/documentation/Swift/true> if your app has navigated back to its default launch scene.

`estimatedSnapshotExpiration`

The preferred date and time for the next background snapshot refresh task.  Use <doc://com.apple.documentation/documentation/Foundation/NSDate/distantFuture> if you do not want to schedule the next refresh.

`userInfo`

Custom data to be associated with the next background snapshot refresh task. This value is assigned to the next [`WKSnapshotRefreshBackgroundTask`](/documentation/WatchKit/WKSnapshotRefreshBackgroundTask) object’s [`userInfo`](/documentation/WatchKit/WKRefreshBackgroundTask/userInfo) property. Pass `nil` if you don’t want to associate any data with the next task.

## Discussion

Call this method as soon as your app finishes updating its user interface. The system provides your extension with a limited amount of time (on the order of seconds) to finish the background snapshot refresh task. If you do not call [`setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:)`](/documentation/WatchKit/WKSnapshotRefreshBackgroundTask/setTaskCompleted(restoredDefaultState:estimatedSnapshotExpiration:userInfo:)) on the task, the system uses all available time, wasting battery power. The system then suspends the extension as soon as the allotted time has expired.

The system automatically takes a snapshot of your app’s user interface as soon as this task is complete. The system also suspends the extension as soon as all background tasks are complete.

---

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)