I have an Obj-C object with a bunch of methods inside of it. Sometimes a method needs to call another method inside the same object. I can't seem to figure out how to get a C method to call a Obj-C method...
WORKS: Obj-C method calling an Obj-C method:
[self objCMethod]; // <--- this does not work
In order for that to work, you should define the C method like this:
void cMethod(id param);
and when you call it, call it like this:
then, you would be able to write:
This is because the
self variable is a special parameter passed to Objective-C methods automatically. Since C methods don't enjoy this privilege, if you want to use
self you have to send it yourself.
See more in the Method Implementation section of the programming guide.