I am passing a string from objective C to javascript in this way -
and in my javascript I am trying to convert the string into an array by -
The way I am using to convert does not seem to work. I am wondering if this is because there is a mismatch in the way the javascript understands the "string" being sent to it?
It would be great if someone could help me out with this.
Code:
NSArray *array = [NSArray arrayWithObjects:@"10",@"9",@"8", nil];
string = [[array valueForKey:@"description"] componentsJoinedByString:@","];
[graphView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"methodName2([%@])", string]];
and in my javascript I am trying to convert the string into an array by -
Code:
function methodName2(val)
{
var b = val;
var temp = new Array();
temp = b.split(',');
alert(temp);
}
The way I am using to convert does not seem to work. I am wondering if this is because there is a mismatch in the way the javascript understands the "string" being sent to it?
It would be great if someone could help me out with this.