Hi All,

What if the handler retain itself, and then will perform some
NSURLConnection tasks, that will async download some data, and receive some
messages as a delegate by implementing
connection:didReceiveResponse
connection:didReceiveData
connection:didFailWithError
connection:didFinishLoading

when the application call the cancel method of NSURLConnection, no chance to
autorelease itself because those delegate methods will not have a chance to
be called as the official document stated:

Cancels an asynchronous load of a request.

- (void)cancel

*Discussion*

Once this method is called, the receiver’s delegate will no longer receive
any messages for this NSURLConnection.
Will this cause memory leak?


On Sun, Jan 2, 2011 at 12:50 AM, Steve Sisak <sgs-li...@codewell.com> wrote:

> There's some good information on this in TechNote 2009
>
> <http://developer.apple.com/library/ios/#technotes/tn2009/tn2109.html>
>
> Also, here is some sample code you might find very helpful:
>
> <http://developer.apple.com/library/mac/#samplecode/LinkedImageFetcher/>
>
> as it does almost what you're describing.
>
> HTH,
>
> -Steve
>
>
>
>
> At 5:28 PM +0800 12/28/10, ico wrote:
>
>> Hi Stephen,
>>
>> Thanks for your reply, so there is no any perfect solution for this kind
>> of
>> problem?
>> And can you give me a specific example to demonstrate why why it is not
>> safe
>> to
>> release these async objects inside a callback method and why not safe to
>> autorelease it?
>> Thanks.
>>
>


-- 
==========================
Life isn't about finding yourself.
Life is about creating yourself.
_______________________________________________

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