I am changing the class of some objects using object_setClass(id object, Class cls). I am changing the class to a subclass of the original class. T
object_setClass(id object, Class cls)
It could crash. As can be seen in the source code of the runtime here, it really just swaps the isa pointer.
isa
If you really want to swap the isa to an isa of a subclass with more ivars, you should use class_createInstance with nonzero extraBytes.
extraBytes