Hey there. I am using JavaScriptCore to import a large JS library into my project and using swift to call my JS code. JavaScriptCore works magic for that and it works flawlessly on ios 11.4+
However--- the exact same file fails to load on pre 11.4 giving a javascript error.
My question is--- what changes between iOS versions to make javascript run successfully on particular versions but not on others.
Is it because we are using webkit which uses a different version of the javascript engine or something like that? Just trying to figure out how to try to support older ios versions and also ensure future compatibility.
Thanks!
if let jsPath = Bundle.main.path(forResource: "bcoin", ofType: "js"),
let js = try? String.init(contentsOfFile: jsPath)
let loaded = context.evaluateScript("\(js)")
Pre iOS 11.4 gives this JS error:
JS ERROR: SyntaxError: Unexpected keyword 'this'. Expected ')' to end an 'if' condition.
11.4+, no error. Why the difference?