• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: multiple declarations for method length (was no subject)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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>)

  • Prev by Date: CamelBones
  • Next by Date: Re: CamelBones
  • Previous by thread: (no subject)
  • Next by thread: Deleting build products & intermediates for all projects on a volume
  • Index(es):
    • Date
    • Thread