简体   繁体   English

从Javascript调用Objective-C函数时如何获取返回值?

[英]How to get return values when calling Objective-C functions from Javascript?

I use JSBridge to call Objective-C functions from JavaScript. 我使用JSBridge从JavaScript调用Objective-C函数。 I see no way to get the results back into the JavaScript without calling another function (from objc) or busy waiting in JavaScript on a variable to change. 我看不出没有调用另一个函数(从objc)或忙于在JavaScript中等待变量更改就无法将结果返回JavaScript的方法。

What is the recommended way to get results from calling objc functions from JavaScript? 从JavaScript调用objc函数获取结果的推荐方法是什么?

There is no way to get results from calls to the JSBridge. 无法通过调用JSBridge获得结果。 All one can do is put a callback methodname in and have it called with the result as a parameter. 所有可以做的就是放一个回调方法名,并以结果作为参数来调用它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM