Re: Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.
Re: Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.
- Subject: Re: Messages without a matching method signature will be assumed to return 'id' and accept '...' as arguments.
- From: Ken Thomases <email@hidden>
- Date: Wed, 3 Dec 2008 12:47:35 -0600
On Dec 3, 2008, at 12:38 PM, Søren Krogh Neigaard wrote:
Hi xcoders
Still pretty new to this Objective-C and have yet not received my
book :p
So I have this class, where I have the following method:
-(CGPoint)getLocalPoint: (UIView*) localView : (CGPoint) globalPoint {
... magic here ...
}
In the same class I have another method that calls this method like
this:
- (void)onTimer {
... vodoo here ...
someView.center = [self getLocalPoint: anotherView :
CGPointMake(320 / 2, 480 / 2)];
}
Now I get this warning plus an error saying: error: incompatible
type for argument 1 of 'setCenter:'
So it seems somehow it can not identify my method, even though it is
in the same class. Im a Java person, what I really wanted is just a
private method here??
The compiler more or less reads the file (or, more accurately, the
output from the preprocessing stage which pulls in included/imported
headers) from top to bottom. So, either the declaration or the
definition of the -getLocalPoint:... method needs to be seen before
its use in order for the compiler to understand what you're talking
about.
It can still be "private" in the sense that it's not advertised to the
world through the @interface. You can do that by: a) defining it
before it's used, b) using a class extension (Objective-C 2.0,
introduced with Leopard), or c) using a category (the technique before
class extensions were added to the language).
Often the warning you see is the result of a typo in typing the
message name, but I don't see that in your snippet. By the way, you
are encouraged to always provide a keyword to introduce each
argument. Apple has a guide to the Cocoa naming conventions:
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CodingGuidelines/
Cheers,
Ken
_______________________________________________
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