KVC not allowing setValue:forKey: on ints
KVC not allowing setValue:forKey: on ints
- Subject: KVC not allowing setValue:forKey: on ints
- From: Ken Tozier <email@hidden>
- Date: Mon, 2 Apr 2007 01:03:12 -0400
Hi
I read the key-value coding documentation and it specifically states
that you should be able to set values without having to first pack
them into an object
"Key-value coding supports properties that are objects, as well as
the scalar data types and structures that are supported by NSNumber
and NSValue. Non-object parameters and return types are detected and
automatically wrapped, and unwrapped, as required."
So how come when I go to compile my project with setValue:forKey: I
get " error: invalid conversion from 'int16' to 'objc_object*'"
For example:
@interface Foo : NSObject
{
int bobo;
}
@end
@implementation Foo
- (id) initFoo
{
self = [super init];
if (self)
{
[self setValue: 10
forKey: @"bobo"];
}
return self;
}
@end
What am I messing up here?
Thanks for any help
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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