• 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
Don't Understand KVC Error Using Array Operators
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Don't Understand KVC Error Using Array Operators


  • Subject: Don't Understand KVC Error Using Array Operators
  • From: Jon Gordon <email@hidden>
  • Date: Tue, 8 Jul 2008 11:02:05 -0400

I can't understand why I'm getting an exception when I try to use the array operators.

Here's what I'm trying to do. One instance variable is a NSMutableArray named "contacts". This array contains instances of objects that have a "call" property, which is an NSString. I have another instance variable, also an NSString, named "exCall". I want to find out whether any contact has a call property that equals exCall.

(It's a ham radio logging program.  Yes, I know I'm a nerd, thanks.)

The following method works:

- (BOOL)callInLog
{
    if (!contacts || ![contacts count] ||
        ![self exCall] || ![[self exCall] length])
        return NO;

    NSEnumerator *e = [[self contacts] objectEnumerator];
    QEContact *contact;
    while (nil != (contact = [e nextObject])) {
        if ([[contact call] isEqual:[self exCall]])
            return YES;
    } // while

    return NO;

} // callsignInLog


The following method throws an exception every time:

- (BOOL)callInLog
{
    if (!contacts || ![contacts count] ||
        ![self exCall] || ![[self exCall] length])
        return NO;

    return ([[self valueForKey:@"email@hidden"]
             containsObject:[self exCall]]);
} // callsignInLog


The message on the console is "Exception raised during posting of notification. Ignored. exception: '[<QELogModel 0x15c3a0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key email@hidden.' invoked observer method: '*** -[NSTextField textDidEndEditing:]' observer: 0x17a0a0 notification name: 'NSTextDidEndEditingNotification'"


Shouldn't the results of the two routines be identical? If not, why not?

(I'm running XCode v. 3.0 on a PPC machine that's running Leopard v. 10.5.4. The target SDK is Mac OS X 10.4 (Universal), with all that entails, such as no garbage collection or ObjC 2.0.)

Thanks for any help,

	-Jon
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Don't Understand KVC Error Using Array Operators
      • From: Ron Lue-Sang <email@hidden>
  • Prev by Date: Re: Proposal for metadata interoperability on OS X
  • Next by Date: Re: iPhone SDK and sms.db file
  • Previous by thread: [Moderator] Re: iPhone SDK and sms.db file
  • Next by thread: Re: Don't Understand KVC Error Using Array Operators
  • Index(es):
    • Date
    • Thread