- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
self.listFeedConnection = nil; // release our connection
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
// create the queue to run our ParseOperation
self.queue = [[NSOperationQueue alloc] init];
// create an ParseOperation (NSOperation subclass) to parse the RSS feed data so that the UI is not blocked
// "ownership of mediaListData has been transferred to the parse operation and should no longer be
// referenced in this thread.
//
ParseOperation *parser = [[ParseOperation alloc] initWithData:listData delegate:self];
[queue addOperation:parser]; // this will start the "ParseOperation"
[parser release];
[queue release];
// ownership of mediaListData has been transferred to the parse operation
// and should no longer be referenced in this thread
self.listData = nil;
}
- (void)dealloc
{
[records release];
[listFeedConnection release];
[listData release];
[queue release];
[super dealloc];
}
问问题
289 次
1 回答
0
If the error message comes from Xcode static analyzer, keep in mind that it is not perfect and it may have false positives. Actually, I don't see any problem with your code, but would suggest trying and replacing it with this:
- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
self.listFeedConnection = nil; // release our connection
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
// create the queue to run our ParseOperation
self.queue = [[[NSOperationQueue alloc] init] autorelease];
// create an ParseOperation (NSOperation subclass) to parse the RSS feed data so that the UI is not blocked
// "ownership of mediaListData has been transferred to the parse operation and should no longer be
// referenced in this thread.
//
ParseOperation *parser = [[[ParseOperation alloc] initWithData:listData delegate:self] autorelease];
[queue addOperation:parser]; // this will start the "ParseOperation"
// ownership of mediaListData has been transferred to the parse operation
// and should no longer be referenced in this thread
self.listData = nil;
}
于 2012-06-20T18:41:23.493 回答