The cancel button on right top corner after a message composer has been presented is not visible in iOS 11 devices. As shown in the screenshot, cancel button works but is not visible. Once we press on it, the screen dismisses.
Asked
Active
Viewed 386 times
-1

rajtharan-g
- 432
- 5
- 14
-
Can you add code as well – Abhishek Thapliyal Mar 12 '18 at 05:38
-
hej, @rajtharan, do you handle the view with its own delegate methods like `canSendText()` as @Abishek mentioned before, or is it just about OS Version problem ? – eemrah Mar 12 '18 at 05:57
-
1Did you ever figure this out? I'm having the same exact issue. – Alan Scarpa Apr 12 '18 at 22:57
-
Getting exactly the same thing, and my code is identical to suggested answer below – Dec 21 '18 at 01:59
1 Answers
0
I have tried like this:
class ViewController: UIViewController, MFMessageComposeViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func Messages(_ sender: UIButton) {
if MFMessageComposeViewController.canSendText() == true {
let recipients:[String] = ["1500"]
let messageController = MFMessageComposeViewController()
messageController.messageComposeDelegate = self
messageController.recipients = recipients
messageController.body = "Your_text"
self.present(messageController, animated: true, completion: nil)
} else {
//handle text messaging not available
}
}
func messageComposeViewController(_ controller: MFMessageComposeViewController, didFinishWith result: MessageComposeResult) {
controller.dismiss(animated: true, completion: nil)
}
}
Added
Messages
andMessageUI
frameworks and imported in view controller.Screenshot:

Community
- 1
- 1

Abhishek Thapliyal
- 3,497
- 6
- 30
- 69
-
I wrote it in Objective-C, unfortunately, that does not work for me on iOS 11. – Reza Dehnavi Feb 04 '19 at 16:39
-