iOS开发# Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.

出问题的过程

对于数组进行操作时Crash

控制台PO打印 Error

#iOS开发# Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.

error: Execution was interrupted, reason: Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.

Crash控制台打印 Error

WX20181219-190146@2x.png

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSArrayI addObject:]: unrecognized selector sent to instance 0x600002fd26d0'

解决方法

对于需要操作的数组使用MutableCopy
self.selectArr = [self.selectArrSup mutableCopy];

#iOS开发# Attempted to dereference an invalid ObjC Object or send it an unrecognized selector.