webviewjavascriptbridge web端怎么使用
发布网友
发布时间:2022-05-13 12:57
我来回答
共1个回答
热心网友
时间:2023-10-10 02:31
webviewjavascriptbridge js端怎么写
//发送一条消息给UI端并定义回调处理逻辑
[_bridge send:@"A string sent from ObjC before Webview has loaded." responseCallback:^(id error, id responseData) {
if (error) { NSLog(@"Uh oh - I got an error: %@", error); }
NSLog(@"objc got response! %@ %@", error, responseData);
}];
//调用名为testObjcCallback的native端处理器,并传递参数,同时设置回调处理逻辑
bridge.callHandler('testObjcCallback', {'foo': 'bar'}, function(response) {
<span style="white-space:pre"> </span>log('Got response from testObjcCallback', response)
})