up vote 0 down vote favorite share [fb] share [tw] |
Apple guide is very specific about releasing connection object: it's done in didFailWithError and connectionDidFinishLoading. 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 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]; } objective-c cocoa nsurlconnection
|
||||||||||
|
show 4 more comments Was this post useful to you? |