objective c - objc Separating tuples -


ran simple objc problem , need help. i'm sending query server gives me tuple wrapped in json. using dictionary sort out.

- (void)viewdidload { [super viewdidload]; nodes *node = [nodes new]; nsdictionary *jsondict = [node nodeactivityfornode:@"17" withdates:nil and:nil]; nsdictionary *jsonactivitydict = [jsondict objectforkey:@"activity"]; nslog(@"activity?: %@", jsonactivitydict);  } 

and heres debug dump

activity?:   (     (     "2013-05-21 16:58:32",     0 ),     (     "2013-05-21 16:58:15",     0 ),     (     "2013-05-21 16:57:59",     0 ), 

i'm trying split comma separated values can put them in individual int , string objects cant think of how in there. appreciated. thanks!

the "activity" data looks array of arrays, not dictionary. if know 3 pairs of values , want 6 values put 6 separate variables this:

nsdictionary *jsondict = [node nodeactivityfornode:@"17" withdates:nil and:nil]; nsarray *jsonactivities = [jsondict objectforkey:@"activity"]; nsstring *date1 = jsonactivities[0][0]; int int1 = [jsonactivities[0][1] intvalue]; nsstring *date2 = jsonactivities[1][0]; int int2 = [jsonactivities[1][1] intvalue]; nsstring *date3 = jsonactivities[2][0]; int int3 = [jsonactivities[2][1] intvalue]; 

note code crash if there less 3 sets of pairs or if of 3 "pairs" has 1 value instead of two.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

java - Using an Integer ArrayList in Android -