Documentation and the NSURLConnectionDelegate Protocol


#1


#2

Looking at the developer site it seems that it’s listed in the URL Programming Guide, but not in the NSURLConnectionDelegate reference.

Not sure which to believe!


#3


#4

All the methods are present in the NSURLConnectionDelegate protocol declaration (in NSURLConnection.h). The methods are somewhat documented in that header file. None of them are flagged as deprecated.

In the organizer documentation, all instance methods show up when you explore or search.

However, on the page they reference, the following are suspicously missing:
connection:willSendRequest:redirectResponse:
connection:needNewBodyStream:
connection:didReceiveResponse:
connection:didReceiveData:
connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite:
connectionDidFinishLoading:
connection:willCacheResponse:

The webpage version of the documentation doesn’t even have them listed as instance methods.


On a related note, some of the NSURLConnectionDelegate protocol methods are listed as being deprecated in the iOS 5.x documentation (Appendix A).
Also in the iOS 5.x documentation, there is a new delegate “NSURLConnectionDownloadDelegate” that conforms to NSURLConnectionDelegate.

Perhaps this class is in flux, and the documentation and source are out of sync with future intended usages. Maybe the iOS 5.x version of the documentation/source is closer to the future?


#5

…is that related with the fact that I don’t get autocomplete with this methods?


#6

Likely.

Currently, the NSURLConnection APIs are in a bit of flux.

In general, though, you’re much more likely to get functional autocomplete for delegate protocol methods if you declare adherence to the protocol in your header… @interface MyClass:NSObject <NSURLConnectionDelegate,NSURLConnectionDataDelegate> //etc.before you begin implementing the methods themselves.


#7

Allright!..I’ll try that!

…I just got to the chapter of the book where’s said that there might be a new protocol for NSURLConnectionDelegate…strangely I didnt get the warning thow…


#8

…ok, so if I include the protocol …it DOES autocomplete…

…but doesn’t seem to exist…!!!


#9

Yeah, this is what I mean when I say that NSURLConnection is in a bit of flux. The protocol exists, but Xcode’s weird about it. Take a peek at NSURLConnection.h, and the NSURLConnection section of the 4.3->5.0 API Diffs doc: developer.apple.com/library/ios/ … index.html


#10

Wow…ok thanks!!