Re: valid method generates warning
Re: valid method generates warning
- Subject: Re: valid method generates warning
- From: Matt Gough <email@hidden>
- Date: Mon, 16 Mar 2009 16:13:23 +0100
A simple question - Is the - (unsigned int)totalNumberOfForks method
actually declared in the @interface section of JBForkController? It is
possible that you have just added its implementation without adding it
to the header. (Obj-C nicely allows that)
Matt
On 16 Mar 2009, at 16:02, Julian Blow wrote:
Dear all,
apologies if this is trivial, but I have spent hours on this problem
and cannot find a way forward...
I have implemented a method:
- (unsigned int)totalNumberOfForks
in a class called JBForkController. I know this method works as
another method in the JBForkController class successfully calls it,
giving no compiler errors. When called within the JBForkController
class, as:
[self totalNumberOfForks];
the method name is shaded dark blue.
I have another class called JBSPhaseController which #imports
JBForkController.h. JBSPhaseController has an instance variable
declared in the header file as JBForkController* theForkController.
As expected if JBForkController.h were correctly imported, the name
JBForkController in this statement is shaded purple.
In one of the JBSPhaseController method implementations, various
methods are called on theForkController. As expected, most of these
method names are shaded dark blue. However, in the statement:
stalledForkSteps+=[theForkController totalNumberOfForks];
totalNumberOfForks is shaded grey and generates a compiler error:
warning: 'JBForkController' may not respond to '-totalNumberOfForks'.
In the problem statement, theForkController is shaded pale blue to
indicate it is recognised as a valid ivar. I have typed and re-typed
the totalNumberOfForks method name many times, all to no avail. I
know it is a valid method call, because when I run the program in
Debug, I can see that the totalNumberOfForks message is correctly
called on this line. If I command-double-click on the name
totalNumberOfForks in this statement, instead of getting a little
box giving me the relevant line numbers in the .h and .m files for
JBForkController (which is what I get for other JBForkController
methods called in this programme block), a new window opens up
showing JBForkController.m at the totalNumberOfForks method. So it
seems XCode can link the method name to the .m file, but is somehow
not seeing it in the .h file. But if I command-double-click on the
totalNumberOfForks method name in its declaration in
JBForkController.h, I also open up JBForkController.m at the
totalNumberOfForks method, suggesting that the .h file links
properly to the method implementation.
This is only a warning, and the program executes perfectly, but it
still worries me. What on earth could cause it? I have cleaned the
whole project many times, and even trashed my XCode preferences
file, but still the problem recurs. The only thing that occurs to me
is that the whole program has rather a large number of different
classes that #import each other in complex ways. Could that be a
cause? If it's of relevance, I'm running XCode 3.0 and OS X 10.5.6.
Thanks in advance,
Julian Blow
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden