nfarshchi
nfarshchi

Reputation: 1000

Calling a method makes Error

I have one method with two arguments. one of them is an Object . when I want to call them it gives me this Error:

reciver type "myView" for instance message does not declare a method with selector "findCp::"

here is the code for my method that i made it less

-(double)findCp:(double)temp obj:(Component *)Obj{
    return temp;
}

here Component is a NSObject class that Obj is one of its Objects. and I call my method in this way:

convertedTemp = [[self findCp:tempreture :Degree]doubleValue];

in actual code it makes some changes on temperature and give it back. also in myView.h I put

-(double)findCp:(double)temp obj:(Component *)Obj;

why I get this error? am I calling my method wrong? am I wrong with definitions?

Upvotes: 1

Views: 26

Answers (1)

Alladinian
Alladinian

Reputation: 35626

Yes you just call the method in a wrong way. Its signature is findCp:obj: instead of findCp::. Your actual call should be:

convertedTemp = [self findCp:tempreture obj:Degree]; // You're returning a double already

PS. Also note that ivar names in Objc usually are named with a starting lowercase letter, while Class names with an uppercase one (by convention).

Upvotes: 3

Related Questions