I thought that I knew how to use fast enumeration, but there is something I don\'t understand about it. If I create three NSString objects and three NSNum
NSString
NSNum
When you write a forin loop like that, it casts every object in the array as an NSString, then prints them out as requested.
If you want only the NSStrings, you would need to write something like this:
for (id obj in array) { if ([obj isKindOfClass:[NSString class]]) { NSLog(@"str: %@", obj); } }