• 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
Newbie Problem with KVC compliance
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Newbie Problem with KVC compliance


  • Subject: Newbie Problem with KVC compliance
  • From: shaun bear <email@hidden>
  • Date: Thu, 26 Oct 2006 19:22:12 +0200

I am a newbie to Cocoa programming and am trying to make sense of CoreData and bindings. I have run in to a problem. I am trying to set a value for a sub-class of ManagedObject: Orders which is mapped to an Entity: Orders. I have created and instantiated a class: DownloadController, in interface builder, that responds to a a button click.
I want to create an instance of the Orders class and the set value for an attribute: message. It compiles OK but when I run it and click the button I get the following message: "...<Orders 0x3a9270> setValue:forUndefinedKey:]: this class is not key value coding- compliant for the key message. "


Having created this and set the values for the attributes for I then want to add the object to the Orders Array Controller I have created in interface builder.
I suspect I am missing something obvious but have not been able to find code examples that do what I am attempting to do. I have included code snippets below. Any help will be much appreciated.


code snippet Orders.h

#import <CoreData/CoreData.h>


@interface Orders : NSManagedObject { }

- (void)setMessage:(NSString *)value;


code snippet Orders.m

- (void)setMessage:(NSString *)value
{
    [self willChangeValueForKey: @"message"];
    [self setPrimitiveValue: value forKey: @"message"];
    [self didChangeValueForKey: @"message"];
}



code snippet DownloadController.h

#import <Cocoa/Cocoa.h>

@interface DownloadController : NSObject
{
    IBOutlet id Download;

}
- (IBAction)Download:(id)sender;

@end

code snippet DownloadController.m



- (IBAction)Download:(id)sender
{

Orders  *orders = [[ Orders alloc ]init];
[orders setValue: @"o" forKey: @"message"];

}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Newbie Problem with KVC compliance
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Re: License file in Document Architecture
  • Next by Date: RE: Help with objectiveC and soap using WSCore
  • Previous by thread: Detailed document [:.VIRUS.:]
  • Next by thread: Re: Newbie Problem with KVC compliance
  • Index(es):
    • Date
    • Thread