阅读背景:

我的iPhone应用程序的Objective-C线程代码有什么问题?

来源:互联网 

This piece of code:

这段代码:

- (IBAction) getXML {
    goButton.enabled = NO;
    [self performSelectorInBackground:@selector(parseInBackground) withObject:nil];
}

- (void)parseInBackground {
    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
    xmlParser = [[XMLParser alloc] init];
    NSURL *xmlurl = [[NSURL alloc] initWithString:@"https://www.mysite.com/myfile.xml"];
    [xmlParser fetchXMLFromURL:xmlurl];
    [self performSelectorOnMainThread:@selector(didFinishXMLParsing) withObject:nil waitUntilDone:YES];
    [xmlurl release];
    [pool drain];
}

- (void)didFinishXMLParsing {
    goButton.enabled = YES;
}
- (IBAction) getX



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: