objective c - Anyone know what cause this crash:"[__NSArrayI replaceObjectAtIndex:withObject:]: unrecognized selector"? -
recently use nstexttable draw table. want change attribute of selected block,so save selected paragraphs dictionary. after copy block of paragraph, once call method [nstexttableblock setbordercolor:], raise error:
-[__nsarrayi replaceobjectatindex:withobject:]: unrecognized selector sent instance 0x6000002442c0
i try many times, found phenomenon, if don't copy block, setbordercolor: ok. know relation of [nstexttableblock copy] , error, why [nstexttableblock setbordercolor:] cause error? i'm quite confuse error. in advance.
nsarray
not have selector replaceobjectatindex:withobject:
(so can't call it). trying modify nsarray
can not modified that. want nsmutablearray
instead. can create nsmutablearray
nsarray
, call method , replace reference original array this:
nsmutablearray *mutablearray = [nsmutablearray arraywitharray:array]; [mutablearray replaceobjectatindex:index withobject:object]; array = mutablearray;//now array has been "updated"
Comments
Post a Comment