• 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
Key-Value Coding default accessor search implementation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Key-Value Coding default accessor search implementation


  • Subject: Key-Value Coding default accessor search implementation
  • From: Francis Derive <email@hidden>
  • Date: Fri, 18 Nov 2005 15:23:21 +0100

Hello,

Exercising on this subject, I get an error when I substitute "myInstance" with "ismyInstance".
It is fine with "_myInstance".


// kvc.h

@interface MYobject : NSObject {
	//NSString *myInstance;	Fine
	//NSString *_myInstance;	Fine
	NSString *ismyInstance;
}
//- (NSString *) myInstance;
//- (void) setmyInstance:(NSString *) anInstance;
@end

// kvc.m
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "MYobject.h"

int main (int argc, const char * argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

MYobject *unObjet = [[MYobject alloc] init];
NSLog(@" what about accessInstanceVariablesDirectly %d", [MYobject accessInstanceVariablesDirectly] ? 1 : 0);
NSLog(@" lecture par kvc valueForKey: -- %@", [unObjet valueForKey:@"myInstance"]);
[unObjet setValue:@"myInstance with kvc" forKey:@"myInstance"];
NSLog(@" lecture par kvc valueForKey: -- %@", [unObjet valueForKey:@"myInstance"]);
// insert code here...
NSLog(@"Hello, World!");
[pool release];
return 0;
}




[Session started at 2005-11-18 15:17:26 +0100.]
2005-11-18 15:17:27.234 KVC[1868] what about accessInstanceVariablesDirectly 1
2005-11-18 15:17:27.304 KVC[1868] *** Uncaught exception: <NSUnknownKeyException> [<MYobject 0x303d80> valueForUndefinedKey:]: this class is not key value coding-compliant for the key myInstance.


KVC has exited due to signal 5 (SIGTRAP).

_______________________________________________
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: Key-Value Coding default accessor search implementation
      • From: Wain <email@hidden>
  • Prev by Date: Re: URL loading system not threadsafe?
  • Next by Date: Re: the right place where put a serial number
  • Previous by thread: Getting the list of all known paper names
  • Next by thread: Re: Key-Value Coding default accessor search implementation
  • Index(es):
    • Date
    • Thread