<!--
{
  "availability" : [
    "iOS: 7.0.0 - 27.0.0",
    "iPadOS: 7.0.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.10.0 - 27.0.0",
    "tvOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "MultipeerConnectivity",
  "identifier" : "/documentation/MultipeerConnectivity/MCSessionDelegate/session(_:didFinishReceivingResourceWithName:fromPeer:at:withError:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Multipeer Connectivity"
    ],
    "preciseIdentifier" : "c:objc(pl)MCSessionDelegate(im)session:didFinishReceivingResourceWithName:fromPeer:atURL:withError:"
  },
  "title" : "session(_:didFinishReceivingResourceWithName:fromPeer:at:withError:)"
}
-->

# session(_:didFinishReceivingResourceWithName:fromPeer:at:withError:)

Indicates that the local peer finished receiving a resource from a nearby peer.

```
func session(_ session: MCSession, didFinishReceivingResourceWithName resourceName: String, fromPeer peerID: MCPeerID, at localURL: URL?, withError error: (any Error)?)
```

## Parameters

`session`

The session through which the data was received.

`resourceName`

The name of the resource, as provided by the sender.

`peerID`

The peer ID of the sender.

`localURL`

An `NSURL` object that provides the location of a temporary file containing the received data.

`error`

An error object indicating what went wrong if the file was not received successfully, or `nil`.

## Discussion

The file referenced by `resourceURL` is a temporary file. Your app must either read the file or make a copy in a permanent location before this delegate method returns.

---

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)