[英]I got error on Xcode7 for String
錯誤是“無法將類型'[AnyObject]'的值轉換為預期的參數類型'[String]?'”。 有誰知道如何解決這一問題?
func send() {
let picker = MFMailComposeViewController()
picker.mailComposeDelegate = self
picker.setSubject(subject.text!)
//the code below is the reason I got error for
picker.setToRecipients(Const.CONTACT_MAIL)
picker.setMessageBody(body.text, isHTML: true)
presentViewController(picker, animated: true, completion: nil)
}
setToRecipients需要一個字符串數組。 Apple文檔提供了此示例
picker.setToRecipients(["address@example.com"])
如果Const.CONTACT_MAIL是字符串,則可以嘗試以下操作:
picker.setToRecipients([Const.CONTACT_MAIL])
這是因為它期望一個數組
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.