This could be me doing the design pattern wrong.
I'm implementing asynchronous delegation in an application that uses NSURLConnection
. An object wraps the NSURLConnection
and handles its delegated messages; that works fine. Now I'm defining my own delegates in the object that uses it (NSURLConnection
messages ConnectionWrapper
, ConnectionWrapper
messages NeedsToUseConnection
, you get the idea), and that works as well, however, Xcode emits this warning:
No '-request:finishedWithResult' method found
This is, presumably, because I'm declaring the delegate I'm calling like this:
id<NSObject> delegate;
...and Xcode is checking what NSObject
declares in the Foundation framework. My custom delegate message is not there. I am properly insulating the call:
if([delegate respondsToSelector:@selector(request:finishedWithResult:)])
[delegate request:self finishedWithResult:ret];
Aside from turning the warning off -- I like to work with as many warnings on as possible -- is there a way to communicate (either syntactically or via a compiler directive) that I am aware this message is undeclared? Should I, instead, be using an interface design pattern for this á la Java? Using id<WillReceiveRequestMessages>
or something?
Open to suggestion.