Re: multiple declarations for method length (was no subject)
Re: multiple declarations for method length (was no subject)
- Subject: Re: multiple declarations for method length (was no subject)
- From: "Louis C. Sacha" <email@hidden>
- Date: Thu, 29 Apr 2004 02:19:28 -0700
Hello...
You would usually do something like this:
columnWidth = [(NSString *)[tempHeaders objectAtIndex:i] length] * 10.0;
The problem is that Apple broke the rules :) and has two different
method signatures for the method length. Normally, when the object is
typed as an NSString (either because the return value of the method
is typed or you have declared a variable), then the compiler knows
which version to use. In this case, since it is an intermediate
object that you haven't explicitly declared anywhere, the NSArray
method returns type id and the compiler has no way to know which
method signature to use.
Hope that helps,
Louis
Hi all,
I have encountered these warning and I'm wondering how to deal with them:
columnWidth is a float;
columnWidth = [[NSNumber numberWithUnsignedInt:[[tempHeaders
objectAtIndex:i] length]] floatValue] * 10.0;
[tempHeaders objectAtIndex:i] will return a NSString but only I know that;-)
using '-(unsigned int)length NSString h:60
also found '-(float)length NSStatusItem h:44
multiple declarations for method 'length'
As you can see I had hoped that telling it that I was expecting a
UnsignedInt would have fixed the warnings. I'm not to sure how to
type cast something in Cocoa. I have used NSString length elsewhere
without this problem.
thanks
Kevin Bracey
"Specialization is for Insects." -- Robert Heinlein
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
References: | |
| >(no subject) (From: Kevin Bracey <email@hidden>) |