Re: Compiler error - method not found on object which conforms to protocol


Sandor Szatmari
 

Thanks Sak,

On Mar 27, 2021, at 04:54, Sak Wathanasin <sw@...> wrote:

On 27 Mar 2021, at 01:41, Sandor Szatmari <admin.szatmari.net@...> wrote:
@protocol dataSrcProto
-(NSUinteger)serverPort;
@end

serverPort isn't a property, so you have to use

This is how I’m working around the error right now.  Like this I get a compiler warning, method not found, return type defaults to id.  
[self.dataSource serverPort];


Port = (NSUInteger)[self.dataSource serverPort];

This succeeds at runtime, but of course smells, and doesn’t squelch the warning.

If you want it to be a property, make it so

I tried implementing serverPort as a property and I still get the same error

Thanks,
Sandor


@protocol dataSrcProto
@property (readonly) NSUinteger serverPort;
@end

Regards
Sak

Join cocoa@apple-dev.groups.io to automatically receive all group messages.