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.
NSArraydoes not have the selectorreplaceObjectAtIndex:withObject:(so you can't call it). You are actually trying to modify anNSArraywhich can not be modified like that. You probably wantNSMutableArrayinstead. You can create anNSMutableArrayfrom anNSArray, call your method and then replace your reference to the original array like this: