Domanda

I am using a library that returns a a series of ints using a parameter that looks like:

int ** outList

What is the best way to take that and wrap it in a bunch of NSNumber objects (and perhaps an NSArray to hold them)?

È stato utile?

Soluzione

There is no shortcut, that I know of. You can write something like this:

int **outList = ...
int count = ...
NSMutableArray *result = [[NSMutableArray alloc] initWithCapacity:count];

for (int idx = 0; idx < count; idx++)
  [result addObject:@(outList[idx])];

Hope it helps!

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top