3

I've looked around all over the place, but I haven't found a solution to this oddly specific problem. I have a UIToolbar that contains, among other buttons, one that calls a method that shows an MFMessageComposeViewController. When it's called, if the person in the Contacts list hasn't been sent a message already, then everything goes fine and dandy. However, if the person has been sent a message already, then the view controller dismisses as soon as it opens, triggering MessageComposeResultCancelled, even though the user didn't get the chance to press the cancel button. Any ideas as to why this is happening?

For good measure, here is my message sending method:

 -(void) showEmailComposer {
if ([MFMessageComposeViewController canSendText]) {

    MFMessageComposeViewController *messageVC = [[MFMessageComposeViewController alloc] init];
    //[messageVC setMessageComposeDelegate:self];

    messageVC.messageComposeDelegate = self;

    NSArray *toRecipients = [NSArray arrayWithObject:@"NUMBER"];
    [messageVC setRecipients:toRecipients];

    NSString *smsString = [NSString stringWithFormat:@"Here's a link to my current location: http://maps.apple.com/?ll=%f,%f", _lat, _lon];
    messageVC.body = smsString;

    messageVC.messageComposeDelegate = self;
    [self presentViewController:messageVC animated:YES completion:nil];
} else {
    UIAlertView *alerty = [[UIAlertView alloc]
                           initWithTitle: @"Unable to send Message"
                           message: @"Sorry, but your device is incapable of sending messages right now."
                           delegate: nil
                           cancelButtonTitle:@"OK"
                           otherButtonTitles:nil];
    [alerty show];
}
}
ravenita
  • 31
  • 4

0 Answers0