NSArray to Monkey Array Conversion
Monkey Targets Forums/iOS/NSArray to Monkey Array Conversion
| ||
Hi there, anybody knows how to convert a NSArray to a Monkey Array? Well i could loop through and use .toNSTring for converting but is there something better? Thanks in advice |
| ||
It looks like looping through NSArray is the way to go. I found something like this on the net during working on in app purchases: unsigned count = [array count]; while (count--) { id object = [array objectAtIndex:count]; } so to convert NSMutableArray of NSStrings to array of monkey strings I did: NSString *item; unsigned count = [productDescriptions count]; unsigned count2 = 0; String descriptions[count]; while (count--) { item = [productDescriptions objectAtIndex:count]; descriptions[count2++] = String(item); } though it's not tested yet, it should work :D |