honghaoz / Ji

Ji (戟) is an XML/HTML parser for Swift
MIT License
824 stars 64 forks source link

function Ji(htmlURL: NSURL) return nil #36

Closed havudk1707 closed 7 years ago

havudk1707 commented 7 years ago

Hi @honghaoz I can read with any website, but this website always return nil let jiDoc = Ji(htmlURL: NSURL(string: "http://michayaa.seesaa.net/")!) Are you have any idea about this case?

honghaoz commented 7 years ago

@havudk1707 Hi,

I tried this code (Swift 3.0):

let doc = Ji(htmlURL: URL(string: "http://michayaa.seesaa.net/")!)
let titleNode = doc?.xPath("//head/title")?.first
print("title: \(titleNode?.content)")

Seems like it works for me, this is the output: title: Optional("怖い話・動画のまとめサイト 見ちゃダメ!!")

Did you get any other warnings/errors in console?

havudk1707 commented 7 years ago

Sorry @honghaoz for the delayed response, I using swift 2. I tested in ios9 it's okey. the output like you. But in ios8 it's always return nil. is it the reason is swift 2 and 3? Thanks for reading.

honghaoz commented 7 years ago

It looks like an iOS8 issue. Because I have no iOS8 devices, cannot debug it directly. Did you notice any weird console output?