我无法传递结果或将值从原生iOS返回到Cordova 1.7.0中的javascript。 Thanx提前..
答案 0 :(得分:0)
您可以在原生iOS中进行编码。
例如
-(void) onClose {
NSString* jsCallback = [NSString stringWithFormat:@"ChildBrowser._onClose(%d);",am.setPage];
[self.webView stringByEvaluatingJavaScriptFromString:jsCallback];
}
然后在“childbrowser.js”文件中编码,
代码:
ChildBrowser._onClose = function(getPg)
{
window.localStorage.setItem("setPage", getPg);
window.plugins.childBrowser.onClose();
};
然后,您可以随时获取javascript文件。
例如
var page = window.localStorage.getItem("setPage");
通过这种方式,
您可以使用插件从native到js代码获取值。
感谢。