简体   繁体   English

MFMessageComposeViewController显示没有取消按钮和标题

[英]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. 我已经在iOS 8.1、8.2、8.3和8.4上对其进行了测试,它适用于所有人。 Is there something changed or I did wrong? 有什么变化或我做错了吗?

Are you using FDFullscreenPopGesture from forkingdog? 您是否使用FDFullscreenPopGesture从forkingdog? If so then this is the problem. 如果是这样,那就是问题所在。 The FDFullscreenPopGesture category somehow got conflict with the pop-uped sms view. FDFullscreenPopGesture类别与弹出的sms视图有某种冲突。 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. 使用MFMessageComposeViewController时,应禁用它。 Notice that setting fd_viewControllerBasedNavigationBarAppearanceEnabled to NO doesn't work. 请注意,将fd_viewControllerBasedNavigationBarAppearanceEnabled设置为NO无效。 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. 这可能是一个较晚的答案,但希望它对其他人有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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