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