我正在创建一个必须在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];
}
答案 0 :(得分:1)
解决方案是保留NSURLConnection