<!--
{
  "availability" : [
    "iOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "TelephonyMessagingKit",
  "identifier" : "/documentation/TelephonyMessagingKit/RCSService/download(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "TelephonyMessagingKit"
    ],
    "preciseIdentifier" : "s:21TelephonyMessagingKit10RCSServiceC8downloadyAC19FileDownloadRequestV8MetadataVAFYaKF"
  },
  "title" : "download(_:)"
}
-->

# download(_:)

Downloads a file from the RCS content server.

```
final func download(_ downloadRequest: RCSService.FileDownloadRequest) async throws -> RCSService.FileDownloadRequest.Metadata
```

## Parameters

`downloadRequest`

A [`RCSService.FileDownloadRequest`](/documentation/TelephonyMessagingKit/RCSService/FileDownloadRequest) that indicates the URL to download and its destination path on the local filesystem.

## Return Value

A [`RCSService.FileDownloadRequest.Metadata`](/documentation/TelephonyMessagingKit/RCSService/FileDownloadRequest/Metadata) instance that contains information about the downloaded file.

## Discussion

Call this method after receiving an [`RCSMessage`](/documentation/TelephonyMessagingKit/RCSMessage) whose content type is [`RCSMessage.Content.fileTransfer(_:)`](/documentation/TelephonyMessagingKit/RCSMessage/Content-swift.enum/fileTransfer(_:)) from the RCS service’s [`incomingMessageNotifications`](/documentation/TelephonyMessagingKit/RCSService/incomingMessageNotifications) asynchronous sequence.
Use the message’s [`fileMetadata`](/documentation/TelephonyMessagingKit/RCSMessage/FileTransfer/fileMetadata) and optional [`thumbnailMetadata`](/documentation/TelephonyMessagingKit/RCSMessage/FileTransfer/thumbnailMetadata), both of type [`RCSFileTransferMetadata`](/documentation/TelephonyMessagingKit/RCSFileTransferMetadata), to get the URLs to download.
The metadata structure also contains other properties which may be useful for downloading, such as the file size and type.

The following example assumes you received a [`RCSMessage.FileTransfer`](/documentation/TelephonyMessagingKit/RCSMessage/FileTransfer) instance called `fileTransferMessage` from the incoming message notifications sequence.
It uses the message’s metadata to get a URL with which to call `download(_:)`, and then uses metadata from the download to get a [`suggestedFileName`](/documentation/TelephonyMessagingKit/RCSService/FileDownloadRequest/Metadata/suggestedFileName) to help place the file in a permanent location.

```swift
let service = TelephonyMessagingSession.shared.rcsService

let cellularServices = try TelephonyMessagingSession.shared.cellularServices
let cellularServiceID = cellularServices[0].id

guard service.isViable(for: cellularServiceID) else { return }

let downloadURL = fileTransferMessage.fileMetadata.url
let temporaryURL = URL.temporaryDirectory
    .appendingPathComponent(downloadURL.lastPathComponent)

// Download file.
let request = RCSService.FileDownloadRequest(cellularServiceID: cellularServiceID,
                                             fileURL: downloadURL,
                                             destinationFileURL: temporaryURL)
let downloadMetadata = try await service.download(request)

// Move file to permanent location, using suggested file name.
let receivedURL = URL.documentsDirectory
    .appendingPathComponent(downloadMetadata.suggestedFileName ?? "Unknown")
try FileManager.default.moveItem(at: temporaryURL,
                                 to: receivedURL)
```

---

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)