• 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
KVC not allowing setValue:forKey: on ints
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: KVC not allowing setValue:forKey: on ints
      • From: James Bucanek <email@hidden>
    • Re: KVC not allowing setValue:forKey: on ints
      • From: Guy English <email@hidden>
  • Prev by Date: Technique to check age of a cached NSURLRequest?
  • Next by Date: Re: KVC not allowing setValue:forKey: on ints
  • Previous by thread: Technique to check age of a cached NSURLRequest?
  • Next by thread: Re: KVC not allowing setValue:forKey: on ints
  • Index(es):
    • Date
    • Thread