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
for (NSString *str in array) {
is a way to enumerate through all the elements in array.
You expectative that by specifying NSString
you get only the objects of that type is not correct. Rather, all the objects pointers are cast to that type (NSString*
).
Have a look at Fast Enumeration in The Objective-C Programming Language guide.