• 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: NSObject copy explanation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSObject copy explanation


  • Subject: Re: NSObject copy explanation
  • From: p3consulting <email@hidden>
  • Date: Fri, 12 Dec 2003 17:44:42 +0100

On 12 dic. 2003, at 15:47, Thierry Bucco wrote:

Hi,

I am 'playing' with ClockControl source code providing by Apple, in
order to insert my custom control in a NSTableView.

I did a modification on the class, since I want to pass a NSDictionary
to the control. All works like a charm, but in the setObjectValue
function (- (void)setObjectValue:(NSObject *)object) I need to copy the
dictionary sent by the NSTableView to my control.


My problem is when I use : newDictionary = [NSDictionary
dictionaryWithDictionary:(NSDictionary *)object];


if objet is not a NSDictionary this will return nil
casting by (NSDictionary *) just makes the compiler warning goes away
but didn't solve the runtime problem if ([object isKindOfClass:[NSDictionary class]]) returns NO.


I get a NULL object, but If I call : newDictionary = [(NSDictionary
*)object copy];


if object is a valid NSObject subclass (any kind supporting the NSCopy protocol) then you assign to the variable newDictionary a copy of it
but that doesn't make a "real" NSDictionary of it ...

Apparently your problem is that the variable"object" doesn't contain a NSDictionary...

check from where it comes from... (the assumption "dictionary sent by the NSTableView to my control" is probably wrong)


Pascal Pochet
P3 Consulting
_______________________________________________
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.

  • Follow-Ups:
    • Re: NSObject copy explanation
      • From: Thierry Bucco <email@hidden>
References: 
 >NSObject copy explanation (From: Thierry Bucco <email@hidden>)

  • Prev by Date: Re: cString vs UTF8String (memory question)
  • Next by Date: Re: NSObject copy explanation
  • Previous by thread: NSObject copy explanation
  • Next by thread: Re: NSObject copy explanation
  • Index(es):
    • Date
    • Thread