tags:

views:

26

answers:

1

Hi there.

There are a few questions about this, but none of them helped me. I can't understand how things go about "calling one class method".

I put a NSObject in Interface Builder. I subclassed it. I connected the object to a table view. I implemented the methods to populate the table view. I used an array, declared inside the object, to populate the table view. I tried to add some random objects. All the methods are working perfectly. I implemented an "addSome" method which takes one argument and adds an object to the array, then it reloads the table view. No warnings.

I add an outlet in the appdelegate class. That outlet refers to the NSObject which cares about the table view. But, when calling...

[outlet addSome...]

I have a warning:

'NSObject' may not respond to '-addSome' [...]

That method is never called. I can't add anything. Is there any concept I am not catching about messaging, function calls and things like that?

Thank you for your help.

+2  A: 

You need to declare the type of your instance var to be the type of your NSObject subclass.

The runtime sees it's an NSObject, which doesn't have the method defined on it, but if you change the type to the type of your subclass which has the method defined on it, it should work fine.

Jacob Relkin
Thanks for the quick answer. It works. :-)
Alberto