up vote
down vote
favorite
share [fb]
share [tw]
Yet, when I do the same, I later get this in zombi-mode
*** -[NSURLConnection releaseDelegate]: message sent to deallocated instance 0x1001045b0
It seems, there's some code in AppKit which releases connection for me.
I'd be happy to assume that Apple guide is wrong, but do not want to get some terrible memory leak or introduce some subtle incompatibility with older OSX versions or something like that.
Is it safe to ignore documentation in this case?
edit
Code creating request
URLConnectionDelegate *delegate = [[URLConnectionDelegate alloc] initWithSuccessHandler:^(NSData *response) {
...
}];
[NSURLConnection connectionWithRequest:request delegate:delegate];
// I do not release delegate when testing for this issue, not sure whether I should in general
Delegate class itself
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
successHandler(receivedData);
[receivedData release];
Block_release(successHandler);
// do we really need this????????
[connection release];
}
asked Feb 6 at 1:24
<a href="http://stackoverflow.com/users/330565/nikita-rybak"></a>
<a href="http://stackoverflow.com/users/330565/nikita-rybak">Nikita Rybak</a>
24.7k32762
78% accept rate
show 4 more comments
Was this post useful to you?
欢迎加群互相学习,共同进步。QQ群:iOS: 58099570 | Android: 572064792 | Nodejs:329118122 做人要厚道,转载请注明出处!
本文转自张昺华-sky博客园博客,原文链接:http://www.cnblogs.com/sunshine-anycall/archive/2011/12/05/2277119.html,如需转载请自行联系原作者