You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/Users/userName/Documents/xcode/appName/DecodeHTML.swift:13:16: Cannot invoke initializer for type 'NSAttributedString' with an argument list of type '(data: NSData, options: NSDictionary, documentAttributes: _, error: _)'
/Users/userName/Documents/xcode/appName/DecodeHTML.swift:13:16: Cannot invoke initializer for type 'NSAttributedString' with an argument list of type '(data: NSData, options: NSDictionary, documentAttributes: _, error: _)'
/Users/userName/Documents/xcode/appName/DecodeHTML.swift:16:16: Cannot invoke initializer for type 'NSAttributedString' with an argument list of type '(data: NSData, options: NSDictionary, documentAttributes: _, error: _)'
Activity
someguy9 commentedon Jan 13, 2016
Same issue here
sluggyly commentedon Feb 3, 2016
use this code
`import Foundation
import UIKit
extension String {
var htmlToString:String {
do {
let string = try NSAttributedString(data: dataUsingEncoding(NSUTF8StringEncoding)!, options: [NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute:NSUTF8StringEncoding], documentAttributes: nil)
return string.string
} catch {
print("Error while parsing")
return String()
}
}
var htmlToNSAttributedString:NSAttributedString {
do {
let string = try NSAttributedString(data: dataUsingEncoding(NSUTF8StringEncoding)!, options: [NSDocumentTypeDocumentAttribute:NSHTMLTextDocumentType,NSCharacterEncodingDocumentAttribute:NSUTF8StringEncoding], documentAttributes: nil)
return string
} catch {
print("Error while parsing")
return NSAttributedString()
}
}
}`