FROM : Tobias Peciva
DATE : Sun Nov 21 21:35:13 2004
On 20/11/2004, at 12:12 PM, Bruce Toback wrote:
> On Nov 19, 2004, at 4:08 PM, Bruce Toback wrote:
>
>> Okay, that looks very much like what I'm doing. But using the code
>>
>> if ([delegate
>> respondsToSelector:@selector(myObject:wantsToTellYou:)])
>> [delegate myObject: self wantsToTellYou: something];
>>
>> I get the warning
>>
>> cannot find method '-myObject:wantsToTellYou:'; return type 'id'
>> assumed
>
> I figured out the difference: the sample on cocoadevcentral declares
> the interface to the delegate as a category on NSObject. This makes
> the compiler happier, since it has an interface.
Or you could just use something along the lines of:
if([delegate respondsToSelector:...])
{
[delegate performSelector:...];
}
Invocations would do the job as well.
That said, it would be interesting to know what Apple's implementation
looks like.
Cheers,
Tobias Peciva
Pharos Systems
DATE : Sun Nov 21 21:35:13 2004
On 20/11/2004, at 12:12 PM, Bruce Toback wrote:
> On Nov 19, 2004, at 4:08 PM, Bruce Toback wrote:
>
>> Okay, that looks very much like what I'm doing. But using the code
>>
>> if ([delegate
>> respondsToSelector:@selector(myObject:wantsToTellYou:)])
>> [delegate myObject: self wantsToTellYou: something];
>>
>> I get the warning
>>
>> cannot find method '-myObject:wantsToTellYou:'; return type 'id'
>> assumed
>
> I figured out the difference: the sample on cocoadevcentral declares
> the interface to the delegate as a category on NSObject. This makes
> the compiler happier, since it has an interface.
Or you could just use something along the lines of:
if([delegate respondsToSelector:...])
{
[delegate performSelector:...];
}
Invocations would do the job as well.
That said, it would be interesting to know what Apple's implementation
looks like.
Cheers,
Tobias Peciva
Pharos Systems
| Related mails | Author | Date |
|---|---|---|
| Bruce Toback | Nov 19, 20:51 | |
| Joakim Danielson | Nov 19, 23:56 | |
| Bruce Toback | Nov 20, 00:08 | |
| Bruce Toback | Nov 20, 00:12 | |
| Douglas A. Welton | Nov 20, 14:28 | |
| Tobias Peciva | Nov 21, 21:35 | |
| Fritz Anderson | Nov 23, 21:15 |






Cocoa mail archive

