मैं अपने अनुप्रयोगों में से एक को ओबीजे-सी से स्विफ्ट में माइग्रेट करने का प्रयास कर रहा हूं और मुझे ईमेल प्रबंधन में कोई समस्या है।
मैंने घंटों की खोज की लेकिन मुझे नहीं मिला कि इस समस्या को कैसे हल किया जाए।
असल में, मैं 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)
}
}
ओएमजी! वास्तव में ठीक काम करता है ... मुझे नहीं पता कि मैंने यह कैसे देखा। आपका बहुत बहुत धन्यवाद!!!! –
अब आप .value – jaminguy
@jaminguy के बजाय .rawValue का उपयोग करते हैं, धन्यवाद –