---
title: "sharingService(_:didFailToShareItems:error:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nssharingservicedelegate/sharingservice(_:didfailtoshareitems:error:)"
---

# sharingService(_:didFailToShareItems:error:)

Invoked when the sharing service encountered an error when sharing items.

## Declaration

```swift
@MainActor optional func sharingService(_ sharingService: NSSharingService, didFailToShareItems items: [Any], error: any Error)
```

## Parameters

- `sharingService`: The sharing service.
- `items`: The items being shared.
- `error`: The error that was encountered when trying to share the item. If the error is doc://com.apple.documentation/documentation/Foundation/NSUserCancelledError-swift.var, the user simply cancelled the error.

## See Also

### Sharing Items

- [sharingService(_:willShareItems:)](appkit/nssharingservicedelegate/sharingservice(_:willshareitems:).md)
- [sharingService(_:didShareItems:)](appkit/nssharingservicedelegate/sharingservice(_:didshareitems:).md)
