One Logo Pool Ball
TelephonyMessagingKit · IOS API REFERENCE

SMSService

class · iOS 26.0+ · SDK 27.1

final class SMSService

A class that provides an interface for performing SMS operations. Use the ``TelephonyMessagingSession`` property ``TelephonyMessagingSession/smsService`` to get an instance of this class. You can then monitor the ``incomingMessageNotifications`` asynchronous sequence to receive notifications of incoming messages, and the ``sendMessage(_:)`` method to send outgoing messages. The following example shows how to send an SMS message with the first service found in the session's ``TelephonyMessagingSession/cellularServices`` array. ```swift import TelephonyMessagingKit let service = TelephonyMessagingSession.shared.smsService let cellularServices = try session.cellularServices let cellularServiceID = cellularServices[0].id guard service.isViable(for: cellularServiceID) else { return } let message = SMSMessage( cellularServiceID: cellularServiceID, handle: SMSHandle(phoneNumber: SAMPLE_PHONE_NUMBER), messageID: SMSMessageID(rawValue: SAMPLE_MESSAGE_ID), content: SMSContent(body: "Hello there.") ) try await service.sendMessage(message) ``` 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.smsService let incomingMessageNotifications = try service.incomingMessageNotifications Task { for await notification in incomingMessageNotifications { let receivedMessage = notification.message // Process receivedMessage. } } ```

Members (6)

method · iOS 26.0+

reportSpam

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

Reports an SMS message as spam to the carrier and to partners. - Parameters: - message: ``SMSMessage`` to report as spam. - Throws: A ``TelephonyMessagingSession/Error/invalidSession`` if the session is no longer valid or an ``SMSService/Error/notSupported`` if the carrier doesn’t support spam reporting.

method · iOS 26.0+

sendMessage

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

Sends an SMS message to the given destination. - Parameters: - message: The SMS message to send. - Throws: - ``TelephonyMessagingSession/Error/invalidSession`` if the session isn't valid.

get · iOS 26.0+

viabilityNotifications

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

An asynchronous sequence of service viability notifications produced by this 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<SMSService.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.

get · iOS 26.0+

criticalMessageStateNotifications

TypeScript
get criticalMessageStateNotifications(): SDKHandle
Swift declaration
final var criticalMessageStateNotifications: some AsyncSequence<SMSService.CriticalMessageStateNotification, Never> { get throws }

An asynchronous sequence of critical message state notifications. This sequence tracks messages sent with the Critical Messaging API, as described in <doc://com.apple.documentation/documentation/Messages/critical-messaging-api>.

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

Skipped declarations

No declarations were skipped in this snapshot.

All TelephonyMessagingKit types →