crash while removing objects from NSMutableArray

前端 未结 6 584
遇见更好的自我
遇见更好的自我 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:09

    This:

    [__NSArrayI removeObject:] : unrecognized selector sent to instance 0xa391640
    

    indicates that your array "surveys" is NSArray (not-mutable). Are you sure you have initialized it properly? If you do it by an assignment like this

    NSMutableArray* surveys = [someManagedObjectContext executeFetchRequest:request]
    

    an array "surveys" will be of type NSArray because Core Data fetch requests return NSArrays.

提交回复
热议问题