discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why does NSDictionary respond to @selector(name)?


From: Andreas Hoeschler
Subject: Why does NSDictionary respond to @selector(name)?
Date: Thu, 9 May 2002 00:30:11 +0200

Hi,

I am tying to port some code to GNUstep. While doing so I encountred the
following


    NSLog(@"valueForKey %@", aKey);
    for (i = 0 ; i < count ; i++)
      {
       id object = [self objectAtIndex:i];
       SEL selector = NSSelectorFromString(aKey);
       id detail = nil;
       NSLog(@"got selector %@", object);
       if ([object respondsToSelector:selector])
         {
          NSLog(@"case 1");
          detail = [object performSelector:selector];
         }


Output:
======
May 08 20:25:53 FBTest[6190] valueForKey name
May 08 20:25:53 FBTest[6190] got selector {name = Person_Extra;
className = FBObject; }
May 08 20:25:53 FBTest[6190] case 1
Bus Error

This code is in a category of NSArray so self is an array and object is
a dictionary. the dictionary has a key name but it should not have a
method name in my opinion. Why is [object respondsToSelector:selector]
returning YES causing a bus error?

Thanks,

    Andreas




reply via email to

[Prev in Thread] Current Thread [Next in Thread]