---
title: "session(_:didFinishReceivingResourceWithName:fromPeer:at:withError:)"
framework: multipeerconnectivity
role: symbol
role_heading: Instance Method
path: "multipeerconnectivity/mcsessiondelegate/session(_:didfinishreceivingresourcewithname:frompeer:at:witherror:)"
---

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

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

## Declaration

```swift
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

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.

## See Also

### MCSession Delegate Methods

- [session(_:didReceive:fromPeer:)](multipeerconnectivity/mcsessiondelegate/session(_:didreceive:frompeer:).md)
- [session(_:didStartReceivingResourceWithName:fromPeer:with:)](multipeerconnectivity/mcsessiondelegate/session(_:didstartreceivingresourcewithname:frompeer:with:).md)
- [session(_:didReceive:withName:fromPeer:)](multipeerconnectivity/mcsessiondelegate/session(_:didreceive:withname:frompeer:).md)
- [session(_:peer:didChange:)](multipeerconnectivity/mcsessiondelegate/session(_:peer:didchange:).md)
- [session(_:didReceiveCertificate:fromPeer:certificateHandler:)](multipeerconnectivity/mcsessiondelegate/session(_:didreceivecertificate:frompeer:certificatehandler:).md)
