Why does fast enumeration not skip the NSNumbers when I specify NSStrings?

前端 未结 8 1128
慢半拍i
慢半拍i 2021-01-14 02:27

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

8条回答
  •  广开言路
    2021-01-14 02:35

    I don't understand where is the unexpected behavior, using the enhanced for loop in an NSMutableArray will just iterate thru every single object in the array which in your case is 6, the result is correct and expected.

    The numbers will just get casted to Strings.

提交回复
热议问题