Sorry if this has been asked before, but I'm wondering what the best memory management practice is for NSURLConnection
. Apple's sample code uses -[NSURLConnection initWithRequest:delegate:]
in one method and then release
s in connection:didFailWithError:
or connectionDidFinishLoading:
, but this spits out a bunch of analyzer warnings and seems sort of dangerous (what if neither of those methods is called?).
I've been autoreleasing (using +[NSURLConnection connectionWithRequest:delegate:]
), which seems cleaner, but I'm wondering--in this case, is it ever possible for the NSURLConnection
to be released before the connection has closed (for instance, when downloading a large file)?