Unclear why if statement doesn't work
Can somebody explain why this doesn't work:
int nrSegments=[segment valueForKeyPath:@"iteneryLegs.@count"];
if (0==nrSegments) {
[self removeSegment:segment];
}
but this does?
int nrSegments=[[segment valueForKeyPath:@"iteneryLegs] count];
if (0==nr开发者_开发技巧Segments) {
[self removeSegment:segment];
}
Because valueForKeyPath:@"iteneryLegs.@count" returns an NSNumber ?
精彩评论