Obj-C에서 Swift로 내 응용 프로그램 중 하나를 마이그레이션하려고하는데 전자 메일 관리에 문제가 있습니다.
몇 시간 씩 검색했지만이 문제를 해결하는 방법을 찾지 못했습니다.
기본적으로 func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!)
기능을 마이그레이션하려고합니다.전자 메일 보내기 - MFMailComposeResult
문제는 스위치 내부의 옵션이 유효하지 않다는 것입니다.
func mailComposeController(controller: MFMailComposeViewController!, didFinishWithResult result: MFMailComposeResult, error: NSError!)
{
switch result.value
{
case CUnsignedInt(MFMailComposeResultCancelled):
var alert = UIAlertController(
title: NSLocalizedString("sendingStatus", tableName: "LocalizationFile", comment:"sendingStatus"),
message: NSLocalizedString("emailCancelledByUser", tableName: "LocalizationFile", comment:"emailCancelledByUser"),
preferredStyle: UIAlertControllerStyle.Alert)
self.presentViewController(alert, animated: true, completion: nil)
case MFMailComposeResult(MFMailComposeResultFailed):
var alert = UIAlertController(
title: NSLocalizedString("sendingStatus", tableName: "LocalizationFile", comment:"sendingStatus"),
message: NSLocalizedString("emailSentFailed", tableName: "LocalizationFile", comment:"emailSentFailed"),
preferredStyle: UIAlertControllerStyle.Alert)
self.presentViewController(alert, animated: true, completion: nil)
case MFMailComposeResultSaved:
var alert = UIAlertController(
title: NSLocalizedString("sendingStatus", tableName: "LocalizationFile", comment:"sendingStatus"),
message: NSLocalizedString("emailSaved", tableName: "LocalizationFile", comment:"emailSaved"),
preferredStyle: UIAlertControllerStyle.Alert)
self.presentViewController(alert, animated: true, completion: nil)
default:
var alert = UIAlertController(
title: NSLocalizedString("sendingStatus", tableName: "LocalizationFile", comment:"sendingStatus"),
message: NSLocalizedString("emailNotSent", tableName: "LocalizationFile", comment:"emailNotSent"),
preferredStyle: UIAlertControllerStyle.Alert)
self.presentViewController(alert, animated: true, completion: nil)
}
}
OMG! 정말 잘 작동 ... 어떻게 보지 못했는지 모르겠다. 대단히 감사합니다 !!!! –
이제는 .value 대신 .rawValue를 사용합니다. – jaminguy
@jaminguy 업데이트 됨, thanks –