Swift 3/XCode 8.2.1/WKWebView: malloc error calling swift from javascript

241 Views Asked by At

After having converted my project to swift 3 I get the following error when I post a simple message (log) from JS though the userContentController

contentController.add(self, name: "log")

func userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage){
    return
}

window.webkit.messageHandlers.log.postMessage(args)

Sample(961,0x1b8f6dc40) malloc: *** error for object 0x1740b38c0:
pointer being freed was not allocated

I run my application on an iPhone 6/10.2. No error with the simulator.

I was able to reproduce this error with another application I downloaded from the web

It seems that's a bug of the framework (JSContext deallocation).

Any idea ?

Bug reported to Apple (29898945)

See below the stack (image).

Thank you so much

enter image description here

0

There are 0 best solutions below