0

我的应用程序有一项功能,允许用户向尚未注册我们应用程序的联系人发送短信以邀请他们。几周前我按如下方式实现了它,效果很好:

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

但是昨天我发现这个功能被破坏了,因为它没有像这样显示取消按钮:

MFMessageComposeViewController 问题

我已经在 iOS 8.1、8.2、8.3 和 8.4 上对其进行了测试,它适用于所有人。有什么改变还是我做错了?

4

1 回答 1

2

你在使用forkingdog的 FDFullscreenPopGesture 吗?如果是这样,那么这就是问题所在。FDFullscreenPopGesture 类别不知何故与弹出的短信视图发生冲突。有一个问题谈论这个。

问题中提供了解决方案,我已经检查过:

您应该在使用 MFMessageComposeViewController 时禁用它。请注意,将 fd_viewControllerBasedNavigationBarAppearanceEnabled 设置为 NO 不起作用。临时解决方案可能是:

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

这可能是一个迟到的答案,但希望它适用于其他人。

于 2016-02-16T23:06:11.163 回答