Why release the NSURLConnection instance in this statement?
Posted
by aquaibm
on Stack Overflow
See other posts from Stack Overflow
or by aquaibm
Published on 2010-05-21T01:58:15Z
Indexed on
2010/05/21
2:00 UTC
Read the original article
Hit count: 331
objective-c
|nsurlconnection
I read this in a book.
-(IBAction) updateTweets
{
tweetsView.text = @"";
[tweetsData release];
tweetsData = [[NSMutableData alloc] init];
NSURL *url = [NSURL URLWithString:@"http://twitter.com/statuses/public_timeline.xml" ];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL: url];
NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[connection release];
[request release];
[activityIndicator startAnimating];
}
In this statement,is that correct to release the "connection" instance at that time? After releasing it which means this NSURLConnection instance will be destroyed since it's reference count is 0 ,how are we going to make this connection operation work? THANKS.
© Stack Overflow or respective owner