Replacing self-> isa due to obsolescence of Xcode 4.6

I just installed Xcode 4.6, and now I get new errors in the ancient code that I control.

the compiler now complains about "Direct access to objective-c isa is deprecated in favor of object_setClass () and object_getClass () and will not create.

so my question is is this the correct equivalent?

self->isa = [CustomClass class];

replaced by:

object_setClass(self, [CustomClass class]);

Thank you

+5
source share
1 answer

Access has been isadeprecated for some time, the tools just did not tell you about it. It is noteworthy that it was deprecated, at least as long as the marked pointers existed in obj-c.

And yes, object_setClass()is a suitable replacement.

, ? , , , , , , ( , , , , , ).

+12

All Articles