On Aug 12, 2010, at 12:26 AM, Hunje Cho wrote:

> Hello,
> 
> I'm just wondering whether autoreleased NSURLConnection object can
> finish its job before released. Like below codes.
> 
> // connect to http server for downloading a large file
> NSURLConnection* con = [NSURLConnection connectionWithRequest:request
> delegate:self];
> 
> // con is not saved as property. I just add codes of delegate messages.
> // do another job
> 
> Does it guarantee to download a file completely? (especially large file)
> Should I use alloc and initialized object of NSURLConnection or
> increase retain count of autoreleased object?

I would not assume so, as it would not be standard behavior and it is not 
documented to do otherwise. It might be worth filing a bug against the docs to 
clarify this.

If you really don't want (or can't have) an instance variable, you can 
init/alloc then release in connectionDidFinishLoading: and 
connection:didFailWithError:. I wouldn't recommend this though, as it is 
probably "bad form", but as long you never want to memory-manage 
NSURLConnections in that class, ever, it would be somewhat future proof.

HTH,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

_______________________________________________

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

Reply via email to