Skip to content

Incorrect argument list #2

Open

Description

@jamesallison

/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

  1. someguy9 commented on Jan 13, 2016

    @someguy9

    Same issue here

  2. sluggyly commented on Feb 3, 2016

    @sluggyly

    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()
    }
    }

    }`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions