Akansha
Akansha

Reputation: 47

return array from javascript function to objective-c xcode

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

Upvotes: 1

Views: 2052

Answers (2)

craned
craned

Reputation: 3051

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.

Upvotes: 1

sElanthiraiyan
sElanthiraiyan

Reputation: 6268

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

Upvotes: 1

Related Questions