3

I have an array of foos and each foo has a NSOrderedSet of bars. I want to get an array of all the distinct existent bars ids (each bar has a property called objectID).

Since there is no @distinctUnionOfOrderedSets I can do it with:

[foos valueForKeyPath:@"bars.objectID.@distinctUnionOfArrays.self"]

And it works, but since the bars are in a NSOrderedSet I get multiple times this error:

-[NSMutableArray addObjectsFromArray:]: array argument is not an NSArray

Is there a way to do this without the error? Is it safe to leave like this?

Flores Robles
  • 656
  • 7
  • 14
  • Suggested: Use NSOrderedSet's array method in the keypath? `[foos valueForKeyPath:@"bars.array.objectID.@distinctUnionOfArrays.self"]`. Alas, didn't work. – stevesliva May 29 '15 at 20:20

0 Answers0