本文介绍了带有swift的MFMessageComposeViewController中MessageComposeResult的条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试实现MFMessageComposeViewControllerDelegate所需的方法

I am attempting to implement the MFMessageComposeViewControllerDelegate's required method

 func messageComposeViewController(controller: MFMessageComposeViewController, didFinishWithResult result: MessageComposeResult) {
    }

问题是我无法弄清楚如何将MessageComposeResult与其比较swift中的关联常量(MessageComposeResultCancelled,MessageComposeResultSent,MessageComposeResultFailed)。到目前为止,我已经尝试过:

The issue is that I can't figure out how to compare the MessageComposeResult with its associated constants in swift(MessageComposeResultCancelled, MessageComposeResultSent, MessageComposeResultFailed). So far I have tried:

result == MessageComposeResultCancelled

result == MessageComposeResult(0)

这两个都返回错误'MessageComposeResult'不能转换为MirrorDisposition。任何有关如何解决此错误的见解将不胜感激。

both of which return the error "'MessageComposeResult' is not convertible to MirrorDisposition". Any insight on how I can resolve this error would be greatly appreciated.

推荐答案

使用 .MessageComposeResultCancelled 或等价物,或许, result.value == MessageComposeResultCancelled

Use .MessageComposeResultCancelled or the equivalents or, perhaps, result.value == MessageComposeResultCancelled

这篇关于带有swift的MFMessageComposeViewController中MessageComposeResult的条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 12:52