crash while removing objects from NSMutableArray

前端 未结 6 564
遇见更好的自我
遇见更好的自我 2021-01-04 00:55

In my iphone project (ARC enabled) i have a nsmuatble array which contains some 5 managed objects (which are retrieved from core data ) and in some scenario i n

6条回答
  •  無奈伤痛
    2021-01-04 01:18

    The answer is very simple.

    For First case.
    Check the part where you have initialized your array, and check if somewhere through your code, if you have assigned an NSArray to your NSMutableArray object.

    For second case.
    You cannot remove objects from the array while you are enumerating through it. This will result in a crash saying array has mutated while enumerating

提交回复
热议问题