cmoulton/grokHTMLAndDownloads

Swift 3 - Alamofire 4 Compatibility & Error in existing code

mhmmdmz opened this issue · 1 comments

Any possibility of a Swift 3 / Alamofire compatibility update? I've been stuck at

urlNode.objectForKeyedSubscript("href") as? String

with Error: Downcast from 'String?' to 'String' only unwraps optionals; did you mean to use '!'?

I've no idea how to get around this and believe started after some futile attempts to update cocoa pods that updated Alamofire.

Please help.

SBrod commented

objectForKeyedSubscript seems to be an error from HTMLReader and has to do with the way swift bridges that to Swift3. the error message says to use subscript (after you fix the optional error message). Use urlNode["href"] or urlNode.attributes["href"] // which is what objectForKeyedSubscript would return.