<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSharingServiceDelegate/sharingService(_:didFailToShareItems:error:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSSharingServiceDelegate(im)sharingService:didFailToShareItems:error:"
  },
  "title" : "sharingService(_:didFailToShareItems:error:)"
}
-->

# sharingService(_:didFailToShareItems:error:)

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

```
@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.

## Discussion

---

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)