Saturday, 11 June 2011

Converting String(passed from objc) to Array in Javascript


i passing string objective c javascript in way -

code:
nsarray *array = [nsarray arraywithobjects:@"10",@"9",@"8", nil];  string = [[array valueforkey:@"description"] componentsjoinedbystring:@","];    [graphview stringbyevaluatingjavascriptfromstring:[nsstring stringwithformat:@"methodname2([%@])", string]];
and in javascript trying convert string array -

code:
function methodname2(val)              {                  var b = val;                  var temp = new array();                  temp = b.split(',');                    alert(temp);              }
the way using convert not seem work. wondering if because there mismatch in way javascript understands "string" being sent it?

great if me out this.
 

what actual string appears in javascript? if it's not string, need "it's not string", , identify is.

actual result after split()?

expression evaluate @ all? need semicolon somewhere? or maybe quotes?

other javascript have tried running objective-c? sure understand basics of evaluating javascript?


saying "does not seem work" remarkably uninformative happening. there billions , billions of ways can "not seem work". if expect debug this, need specific happens.
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment