• 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: copyWithZone: -- selector not recognized
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: copyWithZone: -- selector not recognized


  • Subject: Re: copyWithZone: -- selector not recognized
  • From: Cameron Hayne <email@hidden>
  • Date: Tue, 4 Jun 2002 20:37:12 -0400

Matt Neuburg <email@hidden> wrote:
I have a table view and in : tableView:objectValueForTableColumn:row
I'm trying to return an element
like this:
return itemObj ; //where itemObj is an RSItemObject

Can anyone tell me what am I doing wrong because I'm receiving the
following error message :

>> [RSItemObject copyWithZone : ] : selector not recognized
and I really don't know what might be wrong !

The message tells you exactly what's wrong; you're returning something that
the table view has no way of knowing how to make a copy of.

This is a documentation issue.
The problem is that the error message is referring to something which happens behind the scenes and is not directly related to anything in the original poster's code. He didn't invoke 'copyWithZone' - so he is justifiably confused when he gets the error message. One way to alleviate this difficulty would be to have a searchable list of error messages together with explanations of common causes for the errors.

Anyhow, you
probably wanted to return something like an NSString; how is a table going
to display an itemObj?

This is the real issue. And again it is a documentation issue. As a Cocoa newbie, I have never used an NSTableView and when (sparked by this question) I read the protocol description for tableView:objectValueForTableColumn:row, I didn't see any mention of the crucial fact that the object returned must have an NSFormatter method for the table to use when displaying it. The "Using A Table Data Source" concept page says:
"The NSTableView treats objects provided by its data source as values to be displayed in NSCell objects. If these objects aren't of common value classessuch as NSString, NSNumber, and so onyou'll need to create a custom NSFormatter to display them."
This paragraph should appear in the protocol description.
... Cameron

--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
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.

  • Prev by Date: Re: Color comparison
  • Next by Date: Re: Sound Recording using Cocoa
  • Previous by thread: Re: copyWithZone: -- selector not recognized
  • Next by thread: Sound Recording using Cocoa
  • Index(es):
    • Date
    • Thread