Rajat Mishra
Rajat Mishra

Reputation: 1055

Message Composer in Mac Catalyst not working

I have an iOS app that gives support to Mac Catalyst (and runs in Mac OS). In the app, I have a feature where users can send text messages (basically select phone number, enter message content) via MFMessageComposeViewController. And the code for which is:

if MFMessageComposeViewController.canSendText() {
    let composeVC = MFMessageComposeViewController()
    composeVC.messageComposeDelegate = self
    composeVC.recipients = recipients
    composeVC.body = body
    self.present(composeVC, animated: true, completion: nil)
}

This piece of code works fine in iOS as well as in Mac OS (till mac os bigSur i.e, 11.6, and I tested this by myself). But in the latest Mac OS i.e., Mac OS Monterey (12.0+) this is not working. Basically the method MFMessageComposeViewController.canSendText() always returns false. And if I run the code without checking this condition (just for testing purposes) I get the below exception:

[MFMessageComposeViewController] Unable to initialize due to + [MFMessageComposeViewController canSendText] returns NO.
An uncaught exception was raised
Application tried to present a nil modal view controller on target <MyApp.ViewControllerName:0x7fe3d6e67120>

Has anyone faced this issue or does anyone know if this is an OS bug or something's updated in the code in the latest OS?

Thanks!

Upvotes: 2

Views: 209

Answers (0)

Related Questions