0

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 issue

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?

JAL
  • 41,701
  • 23
  • 172
  • 300
tomisacat
  • 506
  • 4
  • 12
  • i think you are testing it on simulator. try to run this on device and i ope it works perfectly! – Saurabh Prajapati Aug 05 '15 at 03:49
  • When you click the space where these buttons should be placed. It's getting dismiss or send? I think you set the same color that's why it's invisible. – Lucas Huang Aug 05 '15 at 03:58
  • @SaurabhPrajapati I tested it on my device, not simulator. – tomisacat Aug 05 '15 at 04:00
  • @LucasHuang Nothing happened, just like there is no Cancel button. I did not set the BarButtonItem appearance, actually, I deleted all of the appearance setting code to verify whether I have done what you said. – tomisacat Aug 05 '15 at 04:02

1 Answers1

2

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.

Jinhuan Li
  • 53
  • 1
  • 6
  • Yes that's right. Sorry for being so late to send respond. Due to my low reputation I cannot up-vote your answer. – tomisacat Aug 02 '16 at 11:10