0
'的參數列表調用初始值設定項我遵循本示例來解碼HTML值。 TO decode a json parsed value: answered by akashivskyy無法用類型爲'NSAttributedString'的類型爲'
我有這個代碼,我收到以下錯誤:
let encodedString = "The Weeknd ‘King Of The Fall’"
let encodedData = encodedString.dataUsingEncoding(NSUTF8StringEncoding)!
let attributedOptions : [String: AnyObject] = [
NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType,
NSCharacterEncodingDocumentAttribute: NSUTF8StringEncoding
]
let attributedString = NSAttributedString(data: encodedData, options: attributedOptions, documentAttributes: nil, error: nil)!
let decodedString = attributedString.string
錯誤:
Cannot invoke initializer for type 'NSAttributedString' with an argument list of type '(data: NSData, options: [String : AnyObject], documentAttributes: _, error: _)'
任何幫助表示讚賞建議AY答案。
我認爲錯誤是包括在最新的雨燕2.1的異常處理代碼。 – Danboz
對!我忘了試試。 – null