【发布时间】:2016-01-14 20:09:14
【问题描述】:
您好,我在向字典附加值时遇到错误。我正在使用Xcode 7 和Swift 2。
错误消息:无法将 [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)
}
感谢任何帮助。
我不知道为什么人们对这个问题投反对票。!
【问题讨论】:
-
查看我编辑的问题
标签: ios swift dictionary swift2 avspeechsynthesizer