简体   繁体   中英

Sending a SMS in app through MessageUI

Please help to solve the issue of sending invites to the app via SMS or iMessage.

The issue is that when all the receipents of the message have iMessage available (blue button), then upon invitation sending a group consisting of these people gets created, but I need to send the messages separately (not in group).

if MFMessageComposeViewController.canSendText() {
        let messageViewController = MFMessageComposeViewController()

        messageViewController.body = "Some invite text"
        messageViewController.recipients = [phone_numbers_from_contacts]
        messageViewController.messageComposeDelegate = self

        self.present(messageViewController, animated: true, completion: nil)
    } else {
        // Some alert with text "SMS services are not available"
    }

AFAIK you have no control over whether the message is sent as a group message or not.

If you want to send it as individual messages then I would suggest using multiple different instances of the MFMessageComposeViewController .

TBH though, you shouldn't really be using this for sending out spam texts anyway.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM