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

Re: KVC not allowing setValue:forKey: on ints


  • Subject: Re: KVC not allowing setValue:forKey: on ints
  • From: James Bucanek <email@hidden>
  • Date: Sun, 1 Apr 2007 22:39:07 -0700

Ken Tozier wrote on Monday, April 2, 2007:
>- (id) initFoo
>{
>   self = [super init];
>   if (self)
>   {
>       [self setValue: 10
>           forKey: @"bobo"];
>   }
>
>   return self;
>}
>
>@end
>
>What am I messing up here?

I would guess two things:

a) setValue:forKeyPath: (not setValue:forKey:)

b) value is an object (id), not an integer. It should be [self setValue:[NSNumber numberWithInt:10] forKeyPath:@"bobo"];

--
James Bucanek
_______________________________________________

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

References: 
 >KVC not allowing setValue:forKey: on ints (From: Ken Tozier <email@hidden>)

  • Prev by Date: Re: KVC not allowing setValue:forKey: on ints
  • Next by Date: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • Previous by thread: Re: KVC not allowing setValue:forKey: on ints [Solved]
  • Next by thread: error displaying @count via bindings
  • Index(es):
    • Date
    • Thread