您好,我在将值附加到dictornary时出错。我正在使用Xcode 7
和Swift 2
。 错误消息:不能[String: String?]
类型的值转换为预期的参数类型[String: String!]
无法将类型`[String:String?]`的值转换为期望的参数类型`[String:String!]'
声明:
var arrVoiceLanguages: [Dictionary<String, String!>] = []
以下是我的函数
for voice in AVSpeechSynthesisVoice.speechVoices() {
let voiceLanguageCode = (voice as AVSpeechSynthesisVoice).language
let languageName = NSLocale.currentLocale().displayNameForKey(NSLocaleIdentifier, value: voiceLanguageCode)
let dictionary = ["languageName": languageName, "languageCode": voiceLanguageCode]
arrVoiceLanguages.append(dictionary)
}
任何帮助表示赞赏。
我不知道为什么人们对这个问题放弃投票。
看到我编辑的问题 –