Recently I use NSTextTable draw table. I want change some attribute of selected block,so save selected paragraphs into dictionary. After I copy the block of paragraph, once I call method [NSTextTableBlock setBorderColor:], raise an error:
-[__NSArrayI replaceObjectAtIndex:withObject:]: unrecognized selector sent to instance 0x6000002442c0
I try many times, finally found a phenomenon, which is if I don't copy block, setBorderColor: is OK. Anyone know relation of [NSTextTableBlock copy] and this error, why [NSTextTableBlock setBorderColor:] cause this error? I'm quite confuse about this error. Thanks in advance.
NSArray
does not have the selectorreplaceObjectAtIndex:withObject:
(so you can't call it). You are actually trying to modify anNSArray
which can not be modified like that. You probably wantNSMutableArray
instead. You can create anNSMutableArray
from anNSArray
, call your method and then replace your reference to the original array like this: