MFMessageComposeViewController нет интерфейса visibe для presentModalViewController

Я пытаюсь отправить смс программно, но получаю сообщение об ошибке: нет видимого интерфейса для presentModalViewController:completion: . Тот же код работает с presentViewController, но мне нужно отобразить диалоговое окно sms как модальное, чтобы оно вернулось в мое приложение. Любая идея, что мне не хватает?

- (void) sendSMS:(NSString*)txtMsg photo:(UIImage*)image
{
    if (![MFMessageComposeViewController canSendText]) {

        UIAlertView *alertV = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device not support SMS" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil, nil];
        [alertV show];
        return;
   }

    MFMessageComposeViewController *mVC = [[MFMessageComposeViewController alloc] init];

   mVC.body = txtMsg;
   mVC.messageComposeDelegate = self;

    if ([MFMessageComposeViewController canSendAttachments]) {
        NSLog(@"ok");
    }

    [mVC addAttachmentData: UIImagePNGRepresentation(image)   typeIdentifier:@"public.data" filename:@"image.png"];

    // This gives a compilation error
    [self presentModalViewController:mVC animated:YES completion:nil];

    // This compiles but gives the wrong behavior
    // [self presentViewController:mVC animated:YES completion:nil];

} 

person Joel Parker    schedule 07.05.2017    source источник
comment
Проверьте с помощью этого stackoverflow.com/a/27573491/3378413   -  person Mihir Oza    schedule 08.05.2017
comment
Этот пост не открывает его как модальный, поэтому, когда вы нажимаете «Отправить», он не вызывает делегата, чтобы закрыть и вернуться в приложение. Вот почему я спрашиваю конкретно о presentModalViewController   -  person Joel Parker    schedule 08.05.2017