Swany
Swany

Reputation: 633

When does MFMessageComposeViewController.canSendSubject() return false?

I am using the iOS MessageUI framework to present a Message View Controller using MFMessageComposeViewController. I do not understand the return value from canSendSubject(). Apple docs say:

canSendSubject()

Indicates whether or not messages can include subject lines, according to the user’s configuration in Settings.

In my testing, canSendSubject() always returns true despite various combinations of switches in Settings: Messages. I expected the Show Subject Field switch setting would influence the return value, but it doesn't.

Does anyone know under what condition canSendSubject() will return false?

func displayMessagingUI() {
    
    let composeVC = MFMessageComposeViewController()
    composeVC.messageComposeDelegate = self
    composeVC.recipients = [String(8005551212)]
    composeVC.body = "This is a test message."
    
    if MFMessageComposeViewController.canSendSubject() {
        composeVC.subject = "Subject"
    }
    
    self.present(composeVC, animated: true, completion: nil)
}

Screenshot

Testing on iOS 11.1, iPhone X

Upvotes: 2

Views: 469

Answers (1)

Yatendra
Yatendra

Reputation: 1316

canSendSubject()

Indicates whether or not messages can include subject lines, according to the user’s configuration in Settings.

and these settings you can enable or disable.If setting is disable it will return false.

for more info you can visit this link.

Upvotes: -2

Related Questions