One Logo Pool Ball
TelephonyMessagingKit · IOS API REFERENCE

MMSService

class · iOS 26.0+ · SDK 27.1

final class MMSService

A class that provides an interface for performing MMS operations. Use the ``TelephonyMessagingSession`` property ``TelephonyMessagingSession/mmsService`` to get an instance of this class. You can then monitor the ``incomingMessageNotifications`` asynchronous sequence to receive notification of incoming messages, and the ``sendMessage(_:)`` method to send outgoing messages. The following example shows how to send an message consisting of a text portion and an image attachment. ```swift import TelephonyMessagingKit let service = TelephonyMessagingSession.shared.mmsService let cellularServices = try session.cellularServices let cellularServiceID = cellularServices[0].id guard service.isViable(for: cellularServiceID) else { return } var recipients: [MMSHandle] = [] for phone in recipientPhoneNumbers { recipients.append(MMSHandle(phoneNumber: phone)) } var parts: [MMSPartContent] = [] let content1 = MMSPartContent(data: text.data(using: .utf8)!, contentType: UTType.plainText, contentID: UUID().uuidString, disposition: .inline, fileName: "") let content2 = MMSPartContent(data: imageData, contentType: UTType.jpeg, contentID: UUID().uuidString, disposition: .attachment, fileName: "Image_1.jpg") parts.append(content1) parts.append(content2) let content = MMSContent(parts: parts, recipients: recipients, subject: "") let msgID = MMSMessageID(rawValue: SAMPLE_MMS_MESSAGE_ID) let message = MMSMessage(cellularServiceID: cellularServiceID, messageID: msgID, content: content) Task { do { try await service.sendMessage(message:message) // Handle MMS send success. } catch { // Handle MMS send failure. } } ``` To receive messages, iterate over the ``incomingMessageNotifications`` asynchronous sequence, and retrieve messages from each notification as it arrives, as shown below: ```swift import TelephonyMessagingKit let service = TelephonyMessagingSession.shared.mmsService let incomingMessageNotifications = try service.incomingMessageNotifications Task { for await notification in incomingMessageNotifications { let receivedMessage = notification.message // Process receivedMessage. } } ```

Members (7)

method · iOS 26.0+

reportSpam

TypeScript
reportSpam(message: MMSMessage): Promise<void>
Swift declaration
final func reportSpam(_ message: MMSMessage) async throws

Reports an MMS message as spam to the carrier and to partners. - Parameters: - message: `MMSMessage` that needs to be reported as spam. - Throws: - `TelephonyMessagingSession.SessionError.invalidSession` when session has been invalidated. - `MMSService.Error.notSupported` when spam reporting is not supported by carrier.

method · iOS 26.0+

sendMessage

TypeScript
sendMessage(message: MMSMessage): Promise<void>
Swift declaration
final func sendMessage(_ message: MMSMessage) async throws

Sends an MMS message to the given destination. If the ``MMSMessage/totalSize`` exceeds ``MMSService/Configuration/maximumMessageSize``, this call fails with ``MMSService/Error/maximumSizeExceeded``. - Parameters: - message: The MMS message to send. - Throws: - ``MMSService/Error`` if sending the message fails.

method · iOS 26.0+

configuration

TypeScript
configuration(cellularServiceID: CellularServiceID): Promise<MMSService_Configuration>
Swift declaration
final func configuration(for cellularServiceID: CellularServiceID) async throws -> MMSService.Configuration

Retrieves the MMS configuration for the carrier. Fetch the MMS configuration when your app launches and during susbscription change events. - Parameters: - cellularServiceID: The cellular service identifier for which to fetch the MMS configuration. - Returns: An ``MMSService/Configuration`` instance that describes the MMS configuration. - Throws: - ``TelephonyMessagingSession/Error/invalidSession`` if the session isn't valid.

method · iOS 26.0+ · Deprecated in iOS 26.1

receiveMessage

TypeScript
receiveMessage(cellularServiceID: CellularServiceID, messageID: MMSMessageID): Promise<MMSMessage>
Swift declaration
final func receiveMessage(using cellularServiceID: CellularServiceID, messageID: MMSMessageID) async throws -> MMSMessage

Retrieves an MMS message that matches the given identifiers. You get the `cellularServiceID` and `messageID` from an ``MMSService/IncomingMessageNotification`` that you receive from the ``incomingMessageNotifications`` asynchronous sequence. - Parameters: - cellularServiceID: The service identifier to use for this request. - messageID: The message identifier for the target message. - Returns: The message matching the specified identifiers. - Throws: ``TelephonyMessagingSession/Error/invalidSession`` if the session is no longer valid.

get · iOS 26.0+

viabilityNotifications

TypeScript
get viabilityNotifications(): SDKHandle
Swift declaration
final var viabilityNotifications: some AsyncSequence<MMSService.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.

get · iOS 26.0+

incomingMessageNotifications

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

An asynchronous sequence of incoming message notifications produced by the service. Iterate over this sequence with a `for`-`await`-`in` loop to receive ``IncomingMessageNotification`` instances that indicate the arrival of incoming messages.

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 MMS operations at this time. - Parameters: - cellularServiceID: The cellular service identifier for which to check MMS viability. - Returns: `true` if MMS is currently viable for the cellular service; `false`, otherwise.

Skipped declarations

No declarations were skipped in this snapshot.

All TelephonyMessagingKit types →