return value javascript UIWebView

前端 未结 2 1055
醉酒成梦
醉酒成梦 2021-01-02 09:26

i\'m trying to get the return value of a javascript function(for example: return \"hello\") with iPhone SDK.

On OS X the WebView method -stringByE

2条回答
  •  萌比男神i
    2021-01-02 09:45

    I had the same problem when I tried call some functions from google maps API.

    There was a problem with returning objects, so I solved it by function toString().

    NSString *result = [webView stringByEvaluatingJavaScriptFromString:
                    @"map.getBounds().toString();"];
    

提交回复
热议问题