XML データを持つ 2 つの異なる URL を解析しようとしています。
static NSString *string1 = @"http://abc.com/abc1.xml";
NSURLRequest *URL1 =[NSURLRequest requestWithURL:[NSURL URLWithString:string1]];
self.URL1Connection =[[[NSURLConnection alloc] initWithRequest:URL1 delegate:self] autorelease];
static NSString *string2 = @"http://abc.com/abc2.xml";
NSURLRequest *URL2 =[NSURLRequest requestWithURL:[NSURL URLWithString:string2]];
self.URL2Connection =[[[NSURLConnection alloc] initWithRequest:URL2 delegate:self] autorelease];
2 つの異なる NSOperation クラスがあり、どちらも独自の作業を完了する必要があるため、どちらも独立して動作します。2 つの異なる操作を追加した NSOperationqueue である parseQueue があります。
TestOperation *testOperation = [[TestOperation alloc]
initWithData:self.data1 delegate:self ];
[self.parseQueue addOperation:testOperation];
[testOperation release]; // once added to the NSOperationQueue it's retained, we don't need it anymore
testOperation = nil;
Test1Operation *test1Operation = [[Test1Operation alloc]
initWithData:self.data2];
[self.parseQueue addOperation:test1Operation];
[test1Operation release]; // once added to the NSOperationQueue it's retained, we don't need it anymore
test1Operation = nil;
基本的に、2 つの xml データを別々に解析しようとしており、同時操作が必要です。しかし、2 番目の操作がキューへの追加を完了すると、最初のクラスの操作が引き続き参照されます。リリース後も最初のクラスを探している理由がわからないので、これで迷っています。誰かアイデアを出して助けてくれませんか。