Saren Inden
Saren Inden

Reputation: 3660

IOS self->isa deprecated but Object_setClass also gives a warning

I'm busy with a library of a collegae. In his code he sets isa a few times. This stills works but is officially deprecated. The alternative should be the object_setClass function. But when I replace it I get a warning: Implicit declaration of function 'object_setClass' is invalid in C99. Perhaps i am missing an import or something? Anyone an idea? Thanks.

if(nodePtr->type == XML_ELEMENT_NODE)
{
    self->isa = [DDXMLElement class];
    //object_setClass(self, [DDXMLElement class]);
}
else if(nodePtr->type == XML_DOCUMENT_NODE)
{
    self->isa = [DDXMLDocument class];
    //object_setClass(self, [DDXMLDocument class]);
}

Upvotes: 3

Views: 2268

Answers (1)

justin
justin

Reputation: 104698

It's declared in #include <objc/runtime.h> -- have you included that header?

Upvotes: 20

Related Questions