Re: Protocol + Delegate = conflict types

2009-01-16 Thread Christian Giordano
Yep, that made the trick!

Thanks a lot, chr



On Fri, Jan 16, 2009 at 9:07 AM, Quincey Morris
 wrote:
> On Jan 16, 2009, at 00:38, Christian Giordano wrote:
>
>> // RemoteLoader.h
>> @protocol RemoteLoaderDelegate
>> -(void) onLoadingFail:(RemoteLoader *)loader;
>> -(void) onLoadingFinish:(RemoteLoader *)loader;
>> -(void) onLoadingProgress:(RemoteLoader *)loader;
>> @end
>>
>> @interface RemoteLoader : NSObject
>> {
>>...
>> }
>> ...
>> @end
>>
>> I get: "error: syntax error before 'RemoteLoader'"
>
> Your protocol has a forward reference, so this:
>
>> @class RemoteLoader;
>> @protocol RemoteLoaderDelegate
>> -(void) onLoadingFail:(RemoteLoader *)loader;
>> -(void) onLoadingFinish:(RemoteLoader *)loader;
>> -(void) onLoadingProgress:(RemoteLoader *)loader;
>> @end
>
> should take care of it.
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/christian%40nuthinking.com
>
> This email sent to christ...@nuthinking.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Protocol + Delegate = conflict types

2009-01-16 Thread Quincey Morris

On Jan 16, 2009, at 00:38, Christian Giordano wrote:


// RemoteLoader.h
@protocol RemoteLoaderDelegate
-(void) onLoadingFail:(RemoteLoader *)loader;
-(void) onLoadingFinish:(RemoteLoader *)loader;
-(void) onLoadingProgress:(RemoteLoader *)loader;
@end

@interface RemoteLoader : NSObject
{
...
}
...
@end

I get: "error: syntax error before 'RemoteLoader'"


Your protocol has a forward reference, so this:


@class RemoteLoader;
@protocol RemoteLoaderDelegate
-(void) onLoadingFail:(RemoteLoader *)loader;
-(void) onLoadingFinish:(RemoteLoader *)loader;
-(void) onLoadingProgress:(RemoteLoader *)loader;
@end


should take care of it.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Protocol + Delegate = conflict types

2009-01-16 Thread Christian Giordano
Hi guys, I'm trying to implement the Delegate pattern and I would like
a delegate that works like NSURLConnection where any method of the
delegate returns itself. The problem I have is that if I specify its
type in the methods parameters instead of "id":

// RemoteLoader.h
@protocol RemoteLoaderDelegate
-(void) onLoadingFail:(RemoteLoader *)loader;
-(void) onLoadingFinish:(RemoteLoader *)loader;
-(void) onLoadingProgress:(RemoteLoader *)loader;
@end

@interface RemoteLoader : NSObject
{
...
}
...
@end

I get: "error: syntax error before 'RemoteLoader'"


If I leave "id" in the protocol definition:

@protocol RemoteLoaderDelegate
-(void) onLoadingFail:(id)loader;
-(void) onLoadingFinish:(id)loader;
-(void) onLoadingProgress:(id)loader;
@end

but leave the typed parameter in the implemented methods:

-(void) onLoadingFail:(RemoteLoader *)loader
{
...
}

I get: "warning: conflicting types for
'-(void)onLoadingFail:(RemoteLoader *)loader'" but it works.


Is there a way to implement this typed delegation without warning errors?


Thanks for any suggestion, chr
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com