Skip to content

Cannot convert value of type '(AnyObject, WVJBResponseCallback!) -> Void' to expected argument type 'WVJBHandler!' #173

@joshuakaleb0424

Description

@joshuakaleb0424

I'm on this block of code
_bridge = [WKWebViewJavascriptBridge bridgeForWebView:webView webViewDelegate:self handler:^(id data, WVJBResponseCallback responseCallback) {
NSLog(@"ObjC received message from JS: %@", data);
responseCallback(@"Response for message from ObjC");
}];

and converted it to swift code

bridge = WKWebViewJavascriptBridge(forWebView: webView, webViewDelegate: self, handler: {(data: AnyObject, responseCallback: WVJBResponseCallback!) -> Void in
responseCallback("Response for message from ObjC")
})

but I am receiving this error

" Cannot convert value of type '(AnyObject, WVJBResponseCallback!) -> Void' to expected argument type 'WVJBHandler!' "

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions