iOS12 use WKURLSchemeHandler the "#5 0x00000001135602fa in -[WKURLSchemeTaskImpl dealloc] ()" raise exception

in iOS12 we use WKURLSchemeHandler to handle "http" request ,but it raise the exception here is the log

if I keep the WKURLSchemeTask then the request can not be stoped,it keep loadding

above iOS13.0 every thing is ok,any help?

Answered by IhorShevchuk in 718359022
  1. WKURLSchemeHandler is not designed to handle "http" and "https" schemes and you are doing this at your own risk.
  2. WebKit's documentation clearly says that all the methods of WebKit have to be called from main thread, that is not a case for you, as I see from screenshot.

Always call WebKit functions and methods from your app’s main thread or main dispatch queue.

Moving dealloc call to main thread may resolve your issue.

Accepted Answer
  1. WKURLSchemeHandler is not designed to handle "http" and "https" schemes and you are doing this at your own risk.
  2. WebKit's documentation clearly says that all the methods of WebKit have to be called from main thread, that is not a case for you, as I see from screenshot.

Always call WebKit functions and methods from your app’s main thread or main dispatch queue.

Moving dealloc call to main thread may resolve your issue.

iOS12 use WKURLSchemeHandler the "#5 0x00000001135602fa in -[WKURLSchemeTaskImpl dealloc] ()" raise exception
 
 
Q