Comments (3)
Hi Murli,
Since "return" is synchronous and communication with objc is asynchronous you will not able to use "return" to give back a value from objc. You will have to use a callback function.
Cheers!
Marcus
-- while mobile
On Dec 24, 2012, at 3:34 AM, muralikrish [email protected] wrote:
Hi
I have been struggling with an issue for the past few days.The issue is
We have a html page which communicates wih th javascript file teh javascript file in turn communicates with the native ios code of the app using your webview javascript bridge.The problem is
in the following js function we are calling a function of another javascript fileTheApp.getAppVersion = function() { var vpbVersion = VestaPhoneBridge.GetUserAgent().version;
if(vpbVersion != null)
{
return ""+vpbVersion;
}return null;
};
The above method is calling a function in another .js file which is as follows:
VestaPhoneBridge.GetUserAgent = function(_callback)
{
bridge.callHandler('initiateGetUserAgentFunc','test', function(response)
{//getting response here from native }) };
The problem is in the function "bridge.callHandler('initiateGetUserAgentFunc','test', function(response) " inside the above function
we are needed to return a value but we need to return the value to VestaPhoneBridge.GetUserAgent instead of "bridge.callHandler('initiateGetUserAgentFunc','test', function(response)"
The problem is we cannot use callback function in js also.The only thing is we have to return a value.
So it would be really great if you could suggest some solution for this problem.Thanks
Murli Krishna .V—
Reply to this email directly or view it on GitHub.
from webviewjavascriptbridge.
Hi Marcus,
Thank you very much for your answer.
from webviewjavascriptbridge.
Yup yup! Happy to help.
Cheers!
Marcus
from webviewjavascriptbridge.
Related Issues (20)
- Web view is blank after creating the bridge object HOT 1
- iOS14.6 WebViewJavascriptBridge not work but iOS14.3 works HOT 1
- Hello
- Why don't work in iPad Air (14.1) ? HOT 2
- nice
- iOS 15.4 js 交互不走decidePolicyFor 这个代理方法了 HOT 2
- Mac OSX app Packages printed in version 10.15 and above crashed in system 10.14 and below, so far the problem has not been located HOT 1
- nice
- nice
- 我已经重构了这个库,10分钟就能完成接入,也许可以帮助你. HOT 2
- 按照README 第四步拷贝的js代码可能不起作用 HOT 1
- failed assertion `Draw Errors Validation
- Mambamessage
- Installed with CocoaPods in Xcode 15 beta 6 can not build module 'WebKit' HOT 9
- I think that if you no longer maintain this library, then it is recommended that you make this warehouse archived, rather than leave it to grow grass!
- JSBridge H5调用原生的方法,频繁调用的性能优化
- iOS17.1.1 收不到回调 HOT 8
- I
- Invalid string representation for a specification: `WebViewJavascriptBridge(WK) (6.1.0)
- Unblock iphone 8 plus
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webviewjavascriptbridge.