• 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: NSMenuItem protocol and incompatible types.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSMenuItem protocol and incompatible types.


  • Subject: Re: NSMenuItem protocol and incompatible types.
  • From: Jakob Olesen <email@hidden>
  • Date: Tue, 1 Aug 2006 09:35:02 +0200


On 31/07/2006, at 13.58, Fredrik Olsson wrote:

Even typecasting as;
NSMenuItem *foo = (id <NSMenuItem>)[barMenu itemAtIndex:baz];
Gives the same warning. Requiring the typecast when depreciating the protocol seems strange to begin with. What am I missing here?

[NSMenu itemAtIndex:] is declared as

- (id <NSMenuItem>)itemAtIndex:(int)index;

in both the 10.3.9 and 10.4u SDKs, so your cast is completely redundant. Did you mean to write:

NSMenuItem *foo = (NSMenuItem*)[barMenu itemAtIndex:baz];

?

Anyway, like Matt, I get no warnings without the cast.

Are you subclassing NSMenu and changing the return type? That' s a no no.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: refreshObject:mergeChanges: vs. stale transient properties
  • Next by Date: Extract MP3 tags
  • Previous by thread: Re: refreshObject:mergeChanges: vs. stale transient properties
  • Next by thread: Extract MP3 tags
  • Index(es):
    • Date
    • Thread