<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSXPCProxyCreating/remoteObjectProxyWithErrorHandler(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSXPCProxyCreating(im)remoteObjectProxyWithErrorHandler:"
  },
  "title" : "remoteObjectProxyWithErrorHandler(_:)"
}
-->

# remoteObjectProxyWithErrorHandler(_:)

Returns a proxy object that invokes the error handling block if an error occurs on the connection.

```
func remoteObjectProxyWithErrorHandler(_ handler: @escaping @Sendable (any Error) -> Void) -> Any
```

## Parameters

`handler`

The error handling block that the proxy object should call when an error occurs while waiting for a reply.

## Discussion

If the message sent to the proxy has a reply handler, then either the error handler or the reply handler is called exactly once.

The resulting proxy object conforms to the `NSXPCProxyCreating` protocol.

---

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)