Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ashwinr87

macrumors member
Original poster
Mar 9, 2011
81
0
I am trying to pass a array of date values from Objective C to Javascript. I tried to pass it this way -
Code:
NSArray *array = [NSArray arrayWithObjects:@"01-03",@"01-05",@"01-07",@"01-09",@"01-11", nil];
self.dateString = [array componentsJoinedByString:@","];
[wtWebView stringByEvaluatingJavaScriptFromString:[NSString stringWithFormat:@"methodName([%@])", dateString]];

In my Javascript -
Code:
<script>
function methodName(val,val1)
   {
      alert(val1);
   }
</script>

However, what happens here is that the value get displayed as -2, -4, -6, -8, -10 . It literally does a subtraction operation on the values.

Would someone be able to help me out with how I can get this working?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.