简体   繁体   中英

Sending objective-c object to js?

I'm actually doing an UIWebview with html and js in it. A friend doing same with Android

My problem is that on android, there is a way to just send an Android object to the javascript and use it easily in it

But is there a way to do the same in iOS ?

I tried to use windowScriptObject but its not available on iphone. I also tried to send all the datas one per one with

stringByEvaluatingJavaScriptFromString

but it's kinda ugly :/

Is there other solution ?

Thanks

On iOS the only way is to use stringByEvaluatinfJavaScriptFromString.

But why are you calling the data one by one? Package them up into your own data structure, or using Jason is a easy and natural way for passing data to Javascript.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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