One Logo Pool Ball
TelephonyMessagingKit · IOS API REFERENCE

RCSService

class · iOS 26.0+ · SDK 27.1

final class RCSService

A class that provides an interface for performing RCS operations. Use the ``TelephonyMessagingSession`` property ``TelephonyMessagingSession/rcsService`` to get an instance of this class. An `RCSService` sends and receives different kinds of messages, distinguished by the ``RCSMessage/content`` property of ``RCSMessage``: - term ``RCSMessage/Text``: Plain text. - term ``RCSMessage/FileTransfer``: Incoming or outgoing file transfer. To send a file to a receipient, call the ``upload(_:)``: method, then send a message of this type. To receive a file, handle the incoming message from the ``incomingMessageNotifications`` asynchronous sequence, and use its metadata to call ``download(_:)``. - term ``RCSMessage/GeolocationPush``: The sender's location, as indicated by a latitude and longitude pair. - term ``RCSMessage/ComposingIndicator``: An indicator that the sender is currently composing a message. Use this content type to provide "is typing" indicators to recipients. - term ``RCSMessage/DispositionNotification``: An update regarding the processing of a message by the recipient app. This includes things like whether delivery suceeded or failed, and whether the app displayed the message to the recipient. Use the various overloads of `sendMessage(_:to:using:messageID)` to send messages of these types to recipients. The following example shows how to send a plain text message with ``RCSService/sendMessage(_:to:using:messageID:)-(RCSMessage.Text,_,_,_)``: ```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 message = RCSMessage.Text("Hello there.") guard let handle = RCSHandle.phoneNumber(SAMPLE_PHONE_NUMBER) else { return } try await service.sendMessage(message, to: handle, using:cellularServiceID, messageID: RCSMessageID(rawValue: SAMPLE_RCS_MESSAGE_ID)) ``` To receive messages, iterate over the ``incomingMessageNotifications`` asynchronous sequence with a `for`-`await`-`in` loop, then handle each notification based on its message content type, like this: ```swift let service = TelephonyMessagingSession.shared.rcsService let incomingMessageNotifications = try service.incomingMessageNotifications Task { for await notification in incomingMessageNotifications { let receivedMessage = notification.message switch receivedMessage.content { case .text(let text): // ... case .fileTransfer(let fileTransfer): // ... case .geolocationPush(let geolocationPush): // ... case .dispositionNotification(let dispositionNotification): // ... case .composingIndicator(let composingIndicator): // ... } } } ```

Members (28)

method · iOS 26.0+

reportSpam

TypeScript
reportSpam(request: RCSService_ReportSpamRequest): Promise<void>
Swift declaration
final func reportSpam(_ request: RCSService.ReportSpamRequest) async throws

Reports an RCS message as spam to the carrier and to partners. - Parameters: - request: A request that provides details about the spam message. - Throws: If the session is no longer valid, this method throws ``TelephonyMessagingSession/Error/invalidSession``. If the carrier doesn't support spam reporting, the method throws ``RCSService/Error/notSupported``.

method · iOS 26.0+

sendMessage

TypeScript
sendMessageToUsingMessageIDGroup(content: RCSMessage_DispositionNotification, destination: RCSHandle_URI, cellularServiceID: CellularServiceID, messageID: RCSMessageID, group?: (RCSHandle_Group) | null): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.DispositionNotification, to destination: RCSHandle.URI, using cellularServiceID: CellularServiceID, messageID: RCSMessageID, group: RCSHandle.Group? = nil) async throws

Sends the disposition for an incoming message. Your app can send this message so recipients can see if your app received and displayed a given message. - Parameters: - content: The content of the message to send. - destination: Destination handle to send the message disposition to. - cellularServiceID: Service identifier to use for this request. - messageID: Message ID to use for this message. - group: Optional group handle to use when the incoming message is part of a group conversation.

method · iOS 26.0+

sendMessage

TypeScript
sendMessageToUsingMessageID(content: RCSMessage_FileTransfer, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.FileTransfer, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a file transfer message to a specified destination. Use this version of the `sendMessage` method in combination with the ``upload(_:)`` and ``download(_:)`` methods of `RCSService`. To send a file to a recipient, call the upload method and use the returned metadata to create a new ``RCSMessage`` with content that's an instance of ``RCSMessage/FileTransfer``. To receive a file, start by iterating over items in the ``incomingMessageNotifications`` asynchronous sequence. When you get a message with a content value that's ``RCSMessage/Content/fileTransfer(_:)``, use the file URL and other metadata in the associated ``RCSMessage/FileTransfer`` value to call the download method. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/FileTransfer``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message.

method · iOS 27.0+

sendMessage

TypeScript
sendMessageToUsingMessageID11187(content: RCSMessage_CustomReaction, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.CustomReaction, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a custom reaction message to a specified destination. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/CustomReaction``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message.

method · iOS 26.0+

sendMessage

TypeScript
sendMessageToUsingMessageID10310(content: RCSMessage_GeolocationPush, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.GeolocationPush, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a geolocation push message to a specified destination. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/GeolocationPush``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message.

method · iOS 26.0+

sendMessage

TypeScript
sendMessageToUsingMessageID63683(content: RCSMessage_ComposingIndicator, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.ComposingIndicator, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a composing indicator message to a specified destination. Your app can send this message to allow recipients to see an “is typing” indicator. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/ComposingIndicator``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message.

method · iOS 26.0+

sendMessage

TypeScript
sendMessageToUsingMessageID18525(content: RCSMessage_Text, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.Text, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a text message to a specified destination. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/Text``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message. - Throws: If RCS messaging isn't supported, this method throws ``RCSService/Error/notSupported``. If the message exceeds the maximum size, it throws ``RCSService/Error/maximumSizeExceeded``.

method · iOS 27.0+

sendMessage

TypeScript
sendMessageToUsingMessageID56827(content: RCSMessage_Reply, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.Reply, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a reply message to a specified destination. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/Reply``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message.

method · iOS 27.0+

sendMessage

TypeScript
sendMessageToUsingMessageID94469(content: RCSMessage_Reaction, destination: RCSHandle, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendMessage(_ content: RCSMessage.Reaction, to destination: RCSHandle, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends a reaction message to a specified destination. - Parameters: - content: The content of the message to send, as an instance of ``RCSMessage/Reaction``. - destination: The destination handle to send the message to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message. - Throws: If the reaction content is not a valid emoji sequence, this method throws ``RCSService/Error/invalidArgument``.

method · iOS 26.0+

configuration

TypeScript
configuration(cellularServiceID: CellularServiceID): RCSService_Configuration
Swift declaration
final func configuration(for cellularServiceID: CellularServiceID) throws -> RCSService.Configuration

Retrieves the RCS configuration for the specified cellular service. You can observe changes in configuration through the ``viabilityNotifications`` asynchronous sequence. When the service becomes viable, invoke this method to retrieve updates to the RCS configuration.

method · iOS 26.0+

revokeMessage

TypeScript
revokeMessage(request: RCSService_RevokeMessageRequest): Promise<boolean>
Swift declaration
final func revokeMessage(_ request: RCSService.RevokeMessageRequest) async throws -> Bool

Requests revocation of an RCS message. The RCS specification requires that you revoke a message when delivery fails or times out, and fall back to sending the message with SMS or MMS. - Parameters: - request: The request that contains the message to be revoked. - Returns: A Boolean value that indicates whether sending the request to the carrier network succeeded. - Throws: If the session is no longer valid, this method throws ``TelephonyMessagingSession/Error/invalidSession``. If the method can't resolve the handle in the request, it throws ``RCSService/Error/invalidArgument``. If the method can't process the revoke request for other reasons it throws ``RCSService/Error/internalError``.

method · iOS 26.0+

leaveGroupChat

TypeScript
leaveGroupChat(request: RCSService_LeaveGroupChatRequest): Promise<void>
Swift declaration
final func leaveGroupChat(_ request: RCSService.LeaveGroupChatRequest) async throws

Leave a group chat. - Parameters: - request: Request specifying the group to leave. - Throws: ``RCSService/Error`` if there was an error while performing the operation.

method · iOS 26.0+

createGroupChat

TypeScript
createGroupChat(request: RCSService_CreateGroupChatRequest): Promise<RCSService_CreateGroupChatRequest_Result>
Swift declaration
final func createGroupChat(_ request: RCSService.CreateGroupChatRequest) async throws -> RCSService.CreateGroupChatRequest.Result

Creates a group with a list of participants and a specified subject. - Parameters: - request: Request specifying the group to create. - Returns: A ``CreateGroupChatRequest/Result`` that contains the group handle for the group. - Throws: If the messaging service doesn't support group chat, this method throws ``RCSService/Error/notSupported``. If the group chat size exceeds the maximum allowed size, this method throws ``RCSService/Error/maximumSizeExceeded``.

get · iOS 26.0+

groupChatEvents

TypeScript
get groupChatEvents(): SDKHandle
Swift declaration
final var groupChatEvents: some AsyncSequence<RCSService.GroupChatEvent, Never> { get throws }

Returns an asynchronous sequence of incoming group chat notifications produced by this service.

method · iOS 26.0+

remoteCapabilities

TypeScript
remoteCapabilities(request: RCSService_RemoteCapabilitiesRequest): Promise<(RCSService_RemoteCapabilities) | null>
Swift declaration
final func remoteCapabilities(for request: RCSService.RemoteCapabilitiesRequest) async throws -> RCSService.RemoteCapabilities?

Requests remote capability discovery for a given handle - Parameters: - request: `RemoteCapabilitiesRequest` containing the request parameters. - Returns: Remote capabilities for requested handle, if available.

method · iOS 26.0+

businessInformation

TypeScript
businessInformation(request: RCSService_BusinessInformationRequest): Promise<(RCSService_Business) | null>
Swift declaration
final func businessInformation(for request: RCSService.BusinessInformationRequest) async throws -> RCSService.Business?

Requests business information for a specified handle. - Parameters: - request: `BusinessInformationRequest` containing the request parameters. - Returns: The actual render information structure or error.

get · iOS 26.0+

remoteHandleUpdates

TypeScript
get remoteHandleUpdates(): SDKHandle
Swift declaration
final var remoteHandleUpdates: some AsyncSequence<RCSService.RemoteHandleUpdate, Never> { get throws }

An asynchronous sequence of remote handle updates produced by this service. Use a `for`-`await`-`in` loop to receive ``RemoteHandleUpdate`` instances from this property.

method · iOS 26.0+

sendDeviceSpecifics

TypeScript
sendDeviceSpecifics(destination: RCSHandle_URI, cellularServiceID: CellularServiceID, messageID: RCSMessageID): Promise<void>
Swift declaration
final func sendDeviceSpecifics(to destination: RCSHandle.URI, using cellularServiceID: CellularServiceID, messageID: RCSMessageID) async throws

Sends device specifics in response to a suggested action to send device specifics. Call this method after the person using the app selects a ``RCSService/Business/Suggestion`` of type ``RCSService/Business/Suggestion/action(_:)``, whose action type is ``RCSService/Business/SuggestedAction/Action/sendDeviceSpecifics`` . - Parameters: - destination: The destination handle to send device specifics to. - cellularServiceID: The service identifier to use for the message. - messageID: The message identifier to use for the message. - Throws: If the session is no longer valid, this method throws ``TelephonyMessagingSession/Error/invalidSession``. If the method can't process the request for other reasons it throws ``RCSService/Error/internalError``.

method · iOS 26.0+

changeGroupChatSubject

TypeScript
changeGroupChatSubject(request: RCSService_ChangeGroupChatSubjectRequest): Promise<void>
Swift declaration
final func changeGroupChatSubject(_ request: RCSService.ChangeGroupChatSubjectRequest) async throws

Changes subject of a group. - Parameters: - request: Request specifying the group and subject to update. - Throws: ``RCSService/Error`` if there was an error while performing the operation.

method · iOS 26.0+

sendSuggestionResponse

TypeScript
sendSuggestionResponse(response: RCSService_SuggestionResponse): Promise<void>
Swift declaration
final func sendSuggestionResponse(_ response: RCSService.SuggestionResponse) async throws

Sends a response for a business suggestion. - Parameters: - response: `SuggestionResponse` containing the response parameters.

get · iOS 26.0+

viabilityNotifications

TypeScript
get viabilityNotifications(): SDKHandle
Swift declaration
final var viabilityNotifications: some AsyncSequence<RCSService.ViabilityNotification, Never> { get throws }

An asynchronous sequence of service viability notifications produced by the service. Use a `for`-`await`-`in` loop to receive ``ViabilityNotification`` instances from this property.

method · iOS 26.0+

addGroupChatParticipants

TypeScript
addGroupChatParticipants(request: RCSService_AddGroupChatParticipantsRequest): Promise<RCSService_AddGroupChatParticipantsRequest_Result>
Swift declaration
final func addGroupChatParticipants(_ request: RCSService.AddGroupChatParticipantsRequest) async throws -> RCSService.AddGroupChatParticipantsRequest.Result

Adds participants to a group chat. - Parameters: - request: Request specifying the group and participants to add. - Throws: ``RCSService/Error`` if there was an error while performing the operation.

method · iOS 26.0+

removeGroupChatParticipants

TypeScript
removeGroupChatParticipants(request: RCSService_RemoveGroupChatParticipantsRequest): Promise<RCSService_RemoveGroupChatParticipantsRequest_Result>
Swift declaration
final func removeGroupChatParticipants(_ request: RCSService.RemoveGroupChatParticipantsRequest) async throws -> RCSService.RemoveGroupChatParticipantsRequest.Result

Removes participants from a group chat. - Parameters: - request: Request specifying the group and participants to remove. - Throws: `RCSService.Error` if there was an error while performing the operation.

method · iOS 26.5+

sendEncryptedMessageRequest

TypeScript
sendEncryptedMessageRequest(request: RCSService_SendEncryptedMessageRequest): Promise<RCSService_SendEncryptedMessageRequest_Result>
Swift declaration
final func sendEncryptedMessageRequest(_ request: RCSService.SendEncryptedMessageRequest) async throws -> RCSService.SendEncryptedMessageRequest.Result

Sends an encrypted message to a specified destination. Your app may persist the returned ``RCSMessage/SecureSendReceipt`` instance to retry sending the message in the event that the recipient device fails to decrypt the original message. To retry a request, set the ``RCSService/SendEncryptedMessageRequest/secureSendReceipt`` property of the request, after receiving an ``RCSMessage/DispositionNotification`` message whose disposition is ``RCSMessage/Disposition/deliveryFailedDueToDecryptionFailure``.

get · iOS 26.0+

incomingMessageNotifications

TypeScript
get incomingMessageNotifications(): SDKHandle
Swift declaration
final var incomingMessageNotifications: some AsyncSequence<RCSService.IncomingMessageNotification, Never> { get throws }

An asynchronous sequence of incoming message notifications produced by this service. Iterate over this sequence with a `for`-`await`-`in` loop to receive ``IncomingMessageNotification`` instances that indicate the arrival of incoming messages, like this: ```swift let service = TelephonyMessagingSession.shared.rcsService let incomingMessageNotifications = try service.incomingMessageNotifications Task { for await notification in incomingMessageNotifications { let receivedMessage = notification.message switch receivedMessage.content { case .text(let text): // ... case .fileTransfer(let fileTransfer): // ... case .geolocationPush(let geolocationPush): // ... case .dispositionNotification(let dispositionNotification): // ... case .composingIndicator(let composingIndicator): // ... } } ``` For each message type, the matched `case` contains an instance of the relevant ``RCSMessage/Content`` type as its associated value. In this example, `text` would contain string content in its ``RCSMessage/Text/body`` property, and `geolocationPush` would have geolocation values in its ``RCSMessage/GeolocationPush/latitude`` and ``RCSMessage/GeolocationPush/longitude`` properties.

method · iOS 26.0+

upload

TypeScript
upload(uploadRequest: RCSService_FileUploadRequest): Promise<RCSService_FileUploadRequest_Metadata>
Swift declaration
final func upload(_ uploadRequest: RCSService.FileUploadRequest) async throws -> RCSService.FileUploadRequest.Metadata

Uploads a file to the RCS content server. Sending a file to a recipient over RCS is a two-step process: 1. Call `upload(_:)` to upload the file to the carrier. 2. Send a message of type ``RCSMessage/FileTransfer`` to the recipient, using metadata returned from the upload step. The following example shows this process: ```swift let service = TelephonyMessagingSession.shared.rcsService let cellularServices = try TelephonyMessagingSession.shared.cellularServices let cellularServiceID = cellularServices[0].id guard service.isViable(for: cellularServiceID) else { return } guard let uploadURL = URL(string: SAMPLE_UPLOAD_FILE_PATH) else { return } // Upload file. let request = RCSService.FileUploadRequest(cellularServiceID: cellularServiceID, fileURL: uploadURL, contentType: UTType.plainText) let uploadMetadata = try await service.upload(request) // Send file transfer message to recipient handle, using upload metadata. try await service.sendMessage(RCSMessage.FileTransfer(fileMetadata: uploadMetadata.fileMetadata), to: RCSHandle.phoneNumber(SAMPLE_PHONE_NUMBER)!, using: cellularServiceID, messageID: RCSMessageID(rawValue: SAMPLE_RCS_MESSAGE_ID)) ``` - Parameter uploadRequest: A ``FileUploadRequest`` instance that describes the file to upload and an optional thumbnail. - Returns: A ``FileUploadRequest/Metadata`` instance that contains information about the uploaded file. - Throws: If RCS file transfer isn't supported, this method throws ``RCSService/Error/notSupported``. If the file exceeds the maximum size, it throws ``RCSService/Error/maximumSizeExceeded``.

method · iOS 26.0+

download

TypeScript
download(downloadRequest: RCSService_FileDownloadRequest): Promise<RCSService_FileDownloadRequest_Metadata>
Swift declaration
final func download(_ downloadRequest: RCSService.FileDownloadRequest) async throws -> RCSService.FileDownloadRequest.Metadata

Downloads a file from the RCS content server. Call this method after receiving an ``RCSMessage`` whose content type is ``RCSMessage/Content/fileTransfer(_:)`` from the RCS service's ``RCSService/incomingMessageNotifications`` asynchronous sequence. Use the message's ``RCSMessage/FileTransfer/fileMetadata`` and optional ``RCSMessage/FileTransfer/thumbnailMetadata``, both of type ``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`` 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 ``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) ``` - Parameter downloadRequest: A ``FileDownloadRequest`` that indicates the URL to download and its destination path on the local filesystem. - Returns: A ``FileDownloadRequest/Metadata`` instance that contains information about the downloaded file.

method · iOS 26.0+

isViable

TypeScript
isViable(cellularServiceID: CellularServiceID): boolean
Swift declaration
final func isViable(for cellularServiceID: CellularServiceID) -> Bool

Queries whether the device can perform RCS operations at this time. - Parameters: - cellularServiceID: The cellular service identifier for which to check RCS viability. - Returns: `true` if RCS is currently viable for the cellular service; `false`, otherwise.

Skipped declarations

No declarations were skipped in this snapshot.

All TelephonyMessagingKit types →