今天早上我更新到了XCode 8,并选择将我的Swift文件转换为2.3而不是3。除了下面的代码之外,我已经解决了所有的编译问题。实际上,只有MFMailComposeResultSent的情况才能做任何重要的事情。XCode说,MFMailComposeResultSent和其他类似案件都是未解决的标识符。最新的文档显示,我应该使用MFMailComposeResult.sent,自动建议功能提供了一种可能性,但它也拒绝编译。我希望了解如何使此编译与Swift 2.3一起使用。
谢谢。
func mailComposeController(controller:MFMailComposeViewController, didFinishWithResult result:MFMailComposeResult, error:NSError?) {
switch result.rawValue {
case MFMailComposeResultCancelled.rawValue:
print("Mail canceled")
case MFMailComposeResultSaved.rawValue:
print("Mail saved")
case MFMailComposeResultSent.rawValue:
makeToast("Successfully sent email.", duration: 3)
print("Mail sent")
case MFMailComposeResultFailed.rawValue:
print("Mail sent failure: \(error!.localizedDescription)")
default:
break
}
hideActivityIndicator()
self.dismissViewControllerAnimated(true, completion: nil)
}发布于 2016-11-08 16:38:47
rawValue无处不在是怎么回事?打开箱子就行了。如下所示:
switch result {
case .Cancelled: // something
case .Saved: // something
// .. and so onhttps://stackoverflow.com/questions/40492079
复制相似问题