0
試圖分析具有XML數據的兩個不同的URL。需要使用NSOperationQueue來解析兩個不同的NSOperation類
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];
我有兩個不同的NSOperation類都獨立工作,因爲他們都有自己的工作要完成。 我有一個parseQueue這是NSOperationqueue我已經添加了兩個不同的操作。
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;
基本上我試圖解析兩個xml數據分別並希望有併發操作。但是當第二個操作重新加入隊列時,它仍然會查看第一類操作。我迷失在這裏,因爲我不知道爲什麼它在發佈後仍然在尋找頭等艙。任何人都可以提出一些想法並幫助我。