Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to dismiss message window for in-app ios text messaging
    primarykey
    data
    text
    <p>Once the sms window pops up, I cannot get it to close again. The cancel button does not work, and the send button will send the sms but not close the window.</p> <p>I've looked through many of the similar questions on here and they all suggest either implementing the messageComposeViewController method or setting the messageComposeDelegate to self but ive done both of those things and still nothing.</p> <p>Can anybody tell me what I'm doing wrong?</p> <p>.h file</p> <pre><code>#import &lt;MessageUI/MFMessageComposeViewController.h&gt; #import &lt;MessageUI/MessageUI.h&gt; @interface ViewController : UIViewController&lt;CLLocationManagerDelegate,MFMessageComposeViewControllerDelegate,UINavigationControllerDelegate&gt;{ CLLocationManager *locationManager; MKMapView *mapView_; } </code></pre> <p>.m file</p> <pre><code>- (IBAction)SendTextTapped:(id)sender{ MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init]; if([MFMessageComposeViewController canSendText]) { controller.body = @"Hello!"; controller.recipients = [NSArray arrayWithObjects:@"123456", nil]; controller.messageComposeDelegate = self; [self presentViewController:controller animated:YES completion:nil]; } } - (void)messageComposeViewController:(MFMessageComposeViewController*) controller didFinishWithResult:(MessageComposeResult)result error:(NSError*)error; { NSLog(@"Entered messageComposeController"); switch (result) { case MessageComposeResultSent: NSLog(@"SENT"); [self dismissViewControllerAnimated:YES completion:nil]; break; case MessageComposeResultFailed: NSLog(@"FAILED"); [self dismissViewControllerAnimated:YES completion:nil]; break; case MessageComposeResultCancelled: NSLog(@"CANCELLED"); [self dismissViewControllerAnimated:YES completion:nil]; break; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload