From: kimura wataru<ki...@us...> - 2005-12-05 16:36:10
|
Hi, In Objective-C, "==" operator for Cocoa objects tests by address. We can test values of strings with "isEqualToString:" method. I guess the objc compiler makes same address to literal string @"YES". Rupert BARROW wrote: >Hi, > >I've been spending most of the night trying to understand the >following problem : > >When I run the program, the traces from the Objective-C code show : > > record changed=YES, class=NSCFString, res=(null) > record changed=YES, class=NSCFString, res=(null) > record changed=YES, class=NSCFString, res=(null) > record changed=YES, class=NSCFString, res=(null) > record changed=YES, class=NSCFString, res=(null) > changedRecords=() > >What is going on ? I have made every effort for the two ObjC and >RubyCocoa strings be equal : same value ("YES"), same class >(NSCFString); what else ? Why does the test > if ([record valueForKey:@"changed"] == @"YES") >never verify ? > > >Thanks for any help, I'm going to bed %:( >Rup > |