Question

What is the type signature for a method returning type id, with no args?

Example:

class_addMethod(self, sel, imp, "?????"); <---- Require correct type sig here
Était-ce utile?

La solution

"@@:", I think?

Since the function must take at least two arguments—self and _cmd, the second and third characters must be “@:” (the first character is the return type).

Autres conseils

Assuming your IMP looks like

id some_imp(id self, SEL _cmd) {
    //return nil;
}

"@@:" is correct (return an object, take an object and a SEL).

For more type encodings, see the runtime reference.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top