简体   繁体   中英

MFMessageComposeViewController showed without cancel button and title

My app has a feature to allow user sending SMS to their contacts who haven't register our app to invite them. I implemented it as follows several weeks ago and it works well:

if ([MFMessageComposeViewController canSendText]) {
    MFMessageComposeViewController *controller = [MFMessageComposeViewController new];
    NSDictionary *contact = self.notRegisterdUser[index]; // got from reading user's contacts if allowed
    controller.recipients = @[contact.allKeys[0]];
    controller.body = @"some message";
    controller.messageComposeDelegate = self;

    [self presentViewController:controller animated:YES completion:nil];
}

But yesterday I found the feature was broken as it did not show Cancel button like this:

MFMessageComposeViewController问题

I have tested it on iOS 8.1, 8.2, 8.3 and 8.4, it exist for all. Is there something changed or I did wrong?

Are you using FDFullscreenPopGesture from forkingdog? If so then this is the problem. The FDFullscreenPopGesture category somehow got conflict with the pop-uped sms view. There is an issue talking about that.

The solution was provided in the issue and I've checked:

You should disable it when using MFMessageComposeViewController. Notice that setting fd_viewControllerBasedNavigationBarAppearanceEnabled to NO doesn't work. A temporary solution might be:

(void)fd_pushViewController:(UIViewController *)viewController animated:(BOOL)animated { 
    //Add this: 
    if ([self isKindOfClass:[MFMessageComposeViewController class]]) { 
        [self fd_pushViewController:viewController animated:animated];
        return; 
    } 
    ...... 
}

It might be a late answer but hope it works for others.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM