私はこの方法を持っています
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
UIWebView *t_webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 44,
320,480)];
self.webView = t_webView;
self.accel = [[Accelerometer alloc]init];
//Potential Memory Leak here
NSURL *theurl = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"second" ofType:@"html" inDirectory:@"www"]];
[self.webView loadRequest:[NSURLRequest requestWithURL:theurl]];
[self.view addSubview:webView];
[theurl release];//When I add this line, the Memory Leak Warning disappears, but instead I get a "incorrect Decrement of reference count
theurl = nil;
[t_webView release];
}
return self;
}
メモリ管理について何か理解していないと思います。警告を回避する方法を教えてもらえますか?