'undefined' on real device with iOS 16, while working on iOS 18 simulator
Have anyone encountered 'undefined' error? It works fine in simulator, but on device I get 'undefined' Please help, I'm trying to debug in the meantime: latest suspicion is JavaScriptCore on iOS 16 is incpompatible with highlightr.js code
if let highlightr = Highlightr() {
highlightr.setTheme(to: "dark")
let code = "import UIKit"
// You can omit the second parameter to use automatic language detection.
let highlightedCode = highlightr.highlight(code)
self.textView.attributedText = highlightedCode
}
I also encountered this issue. Have you solved it?
Not only iOS 16. iOS 15 crash on supportedLanguages
open func supportedLanguages() -> [String] {
let res = hljs.invokeMethod("listLanguages", withArguments: []) // return undefined
return res!.toArray() as! [String]
}
But I solved it by updating highlightjs to the latest release.
@raspu
Not only iOS 16. iOS 15 crash on
supportedLanguages
open func supportedLanguages() -> [String] { let res = hljs.invokeMethod("listLanguages", withArguments: []) // return undefined return res!.toArray() as! [String] }But I solved it by updating highlightjs to the latest release.
@zeroskylian Could you maybe make a PR with the updated lib? I don't have enough time to maintain this lib, so I would appreciate people's help here.
Not only iOS 16. iOS 15 crash on
supportedLanguagesopen func supportedLanguages() -> [String] { let res = hljs.invokeMethod("listLanguages", withArguments: []) // return undefined return res!.toArray() as! [String] }But I solved it by updating highlightjs to the latest release.
@zeroskylian Could you maybe make a PR with the updated lib? I don't have enough time to maintain this lib, so I would appreciate people's help here.