Key value


#1

Hello,

I’ve been playing around with the RaiseMan program and come across some strange problem.

1)I’ve tried to use method setNilForKey to check if the persone’s name is missing and put John Doe in. However as it turned out this method is being called only if expectedRaise is missing. CAn you give me an idea why?

  1. I’ve tried to do the same using setValue ForKey method that is in fact being called. However i cannot check if the value is nil! I tried everything: value isEqual:nil; value == 0; value isEqual @""… Nothing worked. In the debugger i can see that value = (id) 0x00000000000000 but cannot check it in if statement… Any advice?

[code]

  • (void)setValue:(id)value forKey:(NSString *)key {
    if ([key isEqual:@“personeName”]) {
    if ([value isEqual:nil]) {
    [self setPersoneName:@“John Doe”];
    } else {
    [super setValue:value forKey:key];
    }
    }[/code]

#2

To check for nil:

if (value == nil)
{
     NSLog (@"oops: value is nil!");
}

Also, is the method name setPersoneName: correct? Did you mean setPersonName:?


#3

Thank you. I’ll try that.
The method name is correct - dont ask why i put it with e everywhere =)

Any idea in point 1?