MFMessageComposeViewController rejection and presentation

I am storing a variable that contains an instance of MFMessageComposeViewController. If I click cancel in the SMS view, I have fired the MFMessageComposeViewController.

Now, if I try to present it again, the view loads, but the keyboard is not visible and the view looks like read-only mode. I tried again to create the variable I have for the MFMessageComposeViewController. Then what happens is that I load the view correctly, but the keyboard does not appear like the first time I present the view.

Can you please help on what I am doing wrong?

This is how I represent the view:

messageViewController.body = message;
messageViewController.recipients = [userDefaults.stringForKey("MessageNumber")!];
messageViewController.messageComposeDelegate = self;
self.presentViewController(messageViewController, animated: true, completion: nil);


and how I dismiss it:

case MessageComposeResultCancelled.value:
self.dismissViewControllerAnimated(true, nil);
//messageViewController = MFMessageComposeViewController();



source to share

1 answer

The MessageController should call the rejectViewControllerAnimated () method, not the parent ViewController.

 messageViewController.dismissViewControllerAnimated(true, nil);




All Articles