2

我正在创建一个必须在 Mac OS X Tiger 上运行的 Mac 应用程序。由于某种奇怪的原因,它一直在崩溃。调试器返回以下错误:

0x90a594d1 <+0033> mov (%edi,%edx,4),%eax

我试图用谷歌搜索答案,但我一无所获。我究竟做错了什么?

-(IBAction)loadPage:(id)sender{
    NSURL *URL = [NSURL URLWithString:@"http://www.google.com"];
    [NSURLConnection connectionWithRequest:[NSURLRequest requestWithURL:URL] delegate:self];
    NSLog(@"STARTED!");
}

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
    NSLog(@"STARTED!2");
    data = [[NSMutableData alloc]init];
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)d{
    NSLog(@"STARTED!3");
    [data appendData:d];
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection{

    NSLog(@"STARTED!4");
    NSString *str = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
    NSLog(@"%@", str);

    [webView loadHTMLString:str baseURL:[NSURL URLWithString:[field stringValue]]];

    [str release];
    [data release];
}
4

1 回答 1

1

解决方案是保留 NSURLConnection

于 2012-02-12T18:53:37.473 回答