I have a webpage. I have a javascript file that does a whole lot of stuff. In the app I have an NSString with some crucial data that needs to be processed in the javascrip
Hi we can send the data from objective c to javascript and can callback from javascript easily
Objective-C --> javaScript
In Objective-C class
NSData *locationCountData = [NSJSONSerialization dataWithJSONObject:locationCount options:NSJSONWritingPrettyPrinted error:nil];
NSString *locationCountString = [[NSString alloc] initWithData:locationCountData encoding:NSUTF8StringEncoding];
NSData *locationCountData = [NSJSONSerialization dataWithJSONObject:locationCount options:NSJSONWritingPrettyPrinted error:nil];
NSString *locationCountString = [[NSString alloc] initWithData:locationCountData encoding:NSUTF8StringEncoding];
NSString *str = [NSString stringWithFormat:@"testFunction(%@,%@)",locationCountString, locationsListString];
[self.myWebView stringByEvaluatingJavaScriptFromString: str];
in JavaScript file