Mfmessagecomposeviewcontroller отключается сразу после показа

#objective-c #xcode #ios7 #sms #mfmessagecomposeview

#objective-c #xcode #ios7 #sms #mfmessagecomposeviewcontroller

Вопрос:

Я осмотрелся повсюду, но я не нашел решения этой странно специфической проблемы. У меня есть UIToolbar, который содержит, среди прочих кнопок, ту, которая вызывает метод, который показывает MFMessageComposeViewController. При его вызове, если человеку из списка контактов еще не было отправлено сообщение, тогда все идет хорошо и хорошо. Однако, если пользователю уже было отправлено сообщение, контроллер представления отключается, как только оно открывается, вызывая MessageComposeResultCancelled, даже если пользователь не получил возможности нажать кнопку отмены. Есть идеи относительно того, почему это происходит?

Для хорошей оценки, вот мой метод отправки сообщений:

  -(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];
}
}
  

Комментарии:

1. Я получаю ту же проблему: C