Re: Core Data Entity Relationship -valueForKeyPath: question
Subject : Re: Core Data Entity Relationship -valueForKeyPath: question
From: Quincey Morris <email@hidden >
Date: Mon, 30 Jun 2008 19:42:36 -0700
Delivered-to: email@hidden
Delivered-to: email@hidden
Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=dk20050327; d=earthlink.net; b=ew0OEb95Jr7upKUREEBCTIK4kVS5URMXKNlah1aXUKBAM0mQ90vQJAdgUryhtdz7; h=Received:Message-Id:From:To:In-Reply-To:Content-Type:Content-Transfer-Encoding:Mime-Version:Subject:Date:References:X-Mailer:X-ELNK-Trace:X-Originating-IP;
On Jun 30, 2008, at 19:01, Jamie Phelps wrote:
I have a Core Data entity Item with a relationship
"transaction." (It's actually a to-many relationship. I'll adjust
the key when I migrate my Core Data model.) My question is about
KVC. Can anyone help me understand why the following code always
returns YES? I know for a fact that some of my Item objects should
return NO for this.
-(BOOL)sold{
return ([self valueForKeyPath:@"transaction.@count"] > 0);
}
It's not a KVC issue. You called a method that returns a pointer, then
you compared the pointer to 0 (nil). That's not what you meant to do.
_______________________________________________
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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
This email sent to email@hidden
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.