• 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
Why can't I name a property `tag'?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why can't I name a property `tag'?


  • Subject: Why can't I name a property `tag'?
  • From: an0 <email@hidden>
  • Date: Thu, 10 Jul 2008 21:25:20 +0800

I have a NSString * property named `tag' in my class Foo, and use Foo
instances to populate an NSOutlineView. In one delegate method of
NSOutlineView, I pass the `tag' property of an item to a method as an
NSString * argument as follows:
    - (void)outlineViewSelectionDidChange:(NSNotification *)aNotification
    {
        NSInteger row = [tagView selectedRow];
        if (row == -1) {
            return;
        }

        [filteredPosts release];
        filteredPosts = [[self filterPosts:postNodes WithTag:[[tagView
itemAtRow:row] tag]] retain];
        [postView reloadData];
    }
but a warning of "passing argument 2 of 'filterPosts:WithTag:' makes
pointer from integer without a cast" always pops up when compiling.

I guess it is caused by the fact that NSCell and NSView have a
NSInteger property named `tag'. However, since
  * the root class NSObject does not have such a property,
  * NSOutlineView's item is typed with id,
  * and my class Foo is a direct subclass of NSObject,
what makes XCode think the `tag' property of the item is an NSInteger?
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Why can't I name a property `tag'?
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: Storing structured data in file - any easy way?
  • Next by Date: Re: Why can't I name a property `tag'?
  • Previous by thread: Re: Storing structured data in file - any easy way?
  • Next by thread: Re: Why can't I name a property `tag'?
  • Index(es):
    • Date
    • Thread