2

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!

Rajat Mishra
  • 995
  • 7
  • 18
  • 3
    Yes, I am having the same issue. I've just submitted a bug report Apple via Xcode Feedback, so I'll see if I can any response. I suggest you do the same. – gbotha Aug 05 '22 at 16:19
  • 1
    Did anyone find a solution for the above? – Anis Mansuri Mar 24 '23 at 14:20
  • 1
    This is weird. It fails for me as well under macOS 13.4. But oddly, if I present a UIActivityViewController, Messages is an option and I can send a text through the OS provided interface. – HangarRash Jul 02 '23 at 00:26

0 Answers0