试图解析两个具有 XML 数据的不同 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];
我有两个不同的 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 数据并希望有并发操作。但是当第二个操作完成加入队列时,它仍然会查看第一个类操作。我迷失了,因为我不知道为什么即使在发布后它仍在寻找头等舱。任何人都可以提出一些想法并帮助我。