Re: Does autoreleased NSURLConnection object guarantee job completion?
Re: Does autoreleased NSURLConnection object guarantee job completion?
- Subject: Re: Does autoreleased NSURLConnection object guarantee job completion?
- From: Keary Suska <email@hidden>
- Date: Thu, 12 Aug 2010 12:06:35 -0600
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 (email@hidden)
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:
This email sent to email@hidden