Fernando Valente
Fernando Valente

Reputation: 1096

NSURLConnection bizarre crash

I'm creating a Mac app that must run on Mac OS X Tiger. For some bizarre reason, it keeps crashing. The debugger returns the following error:

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

I've tried to Google the answer, but I found nothing. What am I doing wrong?

-(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];
}

Upvotes: 2

Views: 382

Answers (1)

Fernando Valente
Fernando Valente

Reputation: 1096

The solution was to retain the NSURLConnection

Upvotes: 1

Related Questions