- (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
エラーメッセージがXcode静的アナライザから送信された場合は、完全ではなく、誤検知が発生する可能性があることに注意してください。実際、コードに問題はありませんが、次のコードに置き換えてみることをお勧めします。
- (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 に答える