Re: coding NSNumber in NSArray?

2009-09-14 Thread jon
here is what is in typeOfLeaf. Jon. // --- - (NSNumber*)typeOfLeaf { return typeOfLeaf; } On Sep 14, 2009, at 2:21 PM, Kyle Sluder wrote: But we still need to see -typeOfLeaf to make sure it's doing the

Re: coding NSNumber in NSArray?

2009-09-14 Thread Kyle Sluder
On Mon, Sep 14, 2009 at 12:45 PM, Jens Alfke wrote: > Why not? It looks harmless. Eh, you're right. I had misread the condition. I've never been a fan of IF NOT A OR NOT B THEN C… I've preferred IF NOT (A AND B) THEN C. Obviously the former form is more confusing to me. :) But we still need t

Re: coding NSNumber in NSArray?

2009-09-14 Thread Jens Alfke
On Sep 14, 2009, at 12:33 PM, Kyle Sluder wrote: This is how how you should be implementing this setter. In particular, the !typeOfLeaf condition shouldn't be there. Why not? It looks harmless. I think there are nearly as many favorite ways to write accessor methods as there are Cocoa pro

Re: coding NSNumber in NSArray?

2009-09-14 Thread Quincey Morris
ypeOfLeaf" (we don't know, because we don't get to see the getter declaration). If so, you're *not* getting it out of an array, you're getting it via KVC ('valueForKey:'). So why is your question about "coding NSNumber in NSArray"? What does

Re: coding NSNumber in NSArray?

2009-09-14 Thread Kyle Sluder
On Mon, Sep 14, 2009 at 9:42 AM, jon wrote: > - (void)setTypeOfLeaf:(NSNumber*)flag > { >    if (!typeOfLeaf || ![typeOfLeaf isEqual:flag]) >        { >                [typeOfLeaf release]; >                typeOfLeaf = [flag retain]; >    } > } This is how how you should be implementing this set

Re: coding NSNumber in NSArray?

2009-09-14 Thread Jens Alfke
On Sep 14, 2009, at 12:10 PM, Jon wrote: I don't quite understand why you don't see the word "NSNumber" in my code... when you said twice incorrectly that it doesn't involve an NSNumber nor why you don't see the word "NSArray" in my code. when you said again incorrectly you don't se

Re: coding NSNumber in NSArray?

2009-09-14 Thread Jens Alfke
On Sep 14, 2009, at 12:09 PM, Henry McGilton (Boulevardier) wrote: You're creating an auto-released NSNumber instance, and then releasing it.At a first guess, it's over-released . . . No. Look at the code more carefully. The -release call is on node1, which is a BookMarkNode object no

Re: coding NSNumber in NSArray?

2009-09-14 Thread Jon
I don't quite understand why you don't see the word "NSNumber" in my code... when you said twice incorrectly that it doesn't involve an NSNumber nor why you don't see the word "NSArray" in my code. when you said again incorrectly you don't see an array being used? Nor why you d

Re: coding NSNumber in NSArray?

2009-09-14 Thread Henry McGilton (Boulevardier)
On Sep 14, 2009, at 9:11 AM, jon wrote: I thought i had read that NSNumber knew how to code itself in an NSArray... is this not the case? or is this code below just set up all wrong? and what would the proper way be to set this up? bookMarkNode's coders are below, this object has the

Re: coding NSNumber in NSArray?

2009-09-14 Thread Quincey Morris
On Sep 14, 2009, at 10:38, Jens Alfke wrote: That's not true. NSNumber implements NSCoding, so it's perfectly capable of archiving and unarchiving itself. It already knows internally what the number's representation is. It wasn't me talking, it was those damn typewriter-obsessed monkeys a

Re: coding NSNumber in NSArray?

2009-09-14 Thread Jens Alfke
On Sep 14, 2009, at 10:17 AM, Quincey Morris wrote: Whatever your question is, the answer likely is: don't try to use 'encodeObject:forKey:' to encode NSNumber objects. Use one of the variants like "encodeInteger:forKey:" or "encodeInt32:forKey:" -- you need to tell the archiver which *kin

Re: coding NSNumber in NSArray?

2009-09-14 Thread Jens Alfke
On Sep 14, 2009, at 9:11 AM, jon wrote: I thought i had read that NSNumber knew how to code itself in an NSArray... is this not the case? or is this code below just set up all wrong? and what would the proper way be to set this up? The code looks OK to me. Have you single-stepped throug

Re: coding NSNumber in NSArray?

2009-09-14 Thread Quincey Morris
On Sep 14, 2009, at 09:11, jon wrote: I thought i had read that NSNumber knew how to code itself in an NSArray... is this not the case? or is this code below just set up all wrong? and what would the proper way be to set this up? bookMarkNode's coders are below, this object has the one

Re: coding NSNumber in NSArray?

2009-09-14 Thread jon
I put this code in to retain after you said that, but there was no change in the outcome, still the array shows everything in order, except that the NSNumber comes out as garbage. I checked node1 to see if it was well defined, before and after putting it into the array, and it is.

Re: coding NSNumber in NSArray?

2009-09-14 Thread Randall Meadows
On Sep 14, 2009, at 10:11 AM, jon wrote: I thought i had read that NSNumber knew how to code itself in an NSArray... is this not the case? or is this code below just set up all wrong? and what would the proper way be to set this up? bookMarkNode's coders are below, this object has the

coding NSNumber in NSArray?

2009-09-14 Thread jon
I thought i had read that NSNumber knew how to code itself in an NSArray... is this not the case? or is this code below just set up all wrong? and what would the proper way be to set this up? bookMarkNode's coders are below, this object has the one NSNumber, and two NSStrings wh