if let encodingName = response?.textEncodingName as CFString! , convertedEncoding == nil {
convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(
CFStringConvertIANACharSetNameToEncoding(encodingName))
)
对我的问题有什么想法吗?
答案 0 :(得分:2)
只需使用
if let encodingName = response?.textEncodingName as? CFString , convertedEncoding == nil {
convertedEncoding = String.Encoding(rawValue: CFStringConvertEncodingToNSStringEncoding(
CFStringConvertIANACharSetNameToEncoding(encodingName)))
}
此问题是由强制转换为CFString!