• 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: valueForKeyPath: not found in protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: valueForKeyPath: not found in protocol


  • Subject: Re: valueForKeyPath: not found in protocol
  • From: Remco Poelstra <email@hidden>
  • Date: Tue, 16 Nov 2010 12:01:20 +0100

More elegant indeed :). I thought delegates had to be of type id.

Kind regards,

Remco Poelstra

Op 16 nov 2010, om 11:57 heeft Roland King het volgende geschreven:

> Or use
>
> NSObject*< protocol >
>
> Instead of id. Assuming that all the objects are NSObjects.
>
>
>
> On Nov 16, 2010, at 18:43, Gideon King <email@hidden> wrote:
>
>> AFAIK, when something is referenced as a protocol like that, the *only* methods it knows about are the ones in the protocol. If you just cast the delegate to type id, you should be OK (I have encountered similar situations where this solution worked)
>>
>> [(id)delegate valueForKeyPath:...
>>
>> HTH
>>
>> Gideon
>>
>> On 16/11/2010, at 8:35 PM, Remco Poelstra wrote:
>>
>>> Hi,
>>>
>>> I've somewhat the same problem as a recent thread, but I can't fix it with what was suggested in that thread.
>>> I've to following class:
>>> #import <Foundation/Foundation.h>
>>> #import "AudionetCommand.h"
>>> #import "AudionetQueueDelegateProtocol.h"
>>> @interface AudionetCommandQueue : NSObject {
>>>   id <AudionetQueueDelegate> delegate;
>>> }
>>>
>>> @property (nonatomic, assign) id <AudionetQueueDelegate> delegate;
>>> - (void) enqueueCommand:(AudionetCommand *)command;
>>> @end
>>> @implementation AudionetCommandQueue
>>> @synthesize delegate;
>>> - (void) enqueueCommand:(AudionetCommand *)command {
>>> //Lots of code
>>> if ([[delegate valueForKeyPath:@"audionetDevices.address"] isEqual: []]) {};
>>> }
>>> @end
>>>
>>> I get the warning that valueForKeyPath: is not found in the protocols. If I change the instance variable to id <AudionetQueueDelegate,NSKeyValueCoding>, I get the error that the NSKeyValueCoding protocol can not be found. If I also #import <NSKeyValueCodingProtocol.h> than that header file is not found.
>>> How can I fix this?
>>>
>>> Kind regards,
>>>
>>> Remco Poelstra
>>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please 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

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please 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: 
 >valueForKeyPath: not found in protocol (From: Remco Poelstra <email@hidden>)
 >Re: valueForKeyPath: not found in protocol (From: Gideon King <email@hidden>)
 >Re: valueForKeyPath: not found in protocol (From: Roland King <email@hidden>)

  • Prev by Date: Re: valueForKeyPath: not found in protocol
  • Next by Date: Re: valueForKeyPath: not found in protocol
  • Previous by thread: Re: valueForKeyPath: not found in protocol
  • Next by thread: Re: valueForKeyPath: not found in protocol
  • Index(es):
    • Date
    • Thread