1

IS it possible to get a array of strings from Javascript. I mean I am calling javascript in my code for iPhone app. Now After the functions completes I want to return the array of string to the objective C code back. How can I return the array back and how my objective-c code can read that array?

Thanks Akansha

Akansha
  • 47
  • 1
  • 11

2 Answers2

1

You have to use webview's

- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

delegate method. See my answer here.

iOS UIWebView Javascript - insert data -receive callbacks?

UPDATE FOR COMMENT:

and this one,

Submit a form in UIWebView

Community
  • 1
  • 1
sElanthiraiyan
  • 6,000
  • 1
  • 31
  • 38
1

Here's a more direct way to do it. Call JSON.stringify on the JSON object to be returned from your function. Then convert that string to an NSDictionary, something similar to this.

Community
  • 1
  • 1
craned
  • 2,991
  • 2
  • 34
  • 38