Instance Method

session(_:didReceive:)

Called when a file is received successfully.

Declaration

optional func session(_ session: WCSession, didReceive file: WCSessionFile)

Parameters

session

The session object of the current process.

file

The object containing the URL of the file and any additional information. If you want to keep the file referenced by this parameter, you must move it synchronously to a new location during your implementation of this method. If you do not move the file, the system deletes it after this method returns.

Discussion

The session object calls this method when it successfully receives a file from its counterpart. Implement this method and use it to incorporate the file information into the current app. This method is called on a background thread of your app.

See Also

Managing File Transfers

func session(WCSession, didFinish: WCSessionFileTransfer, error: Error?)

Called when a file transfer finished successfully or because of an error.