【发布时间】:2011-11-12 06:12:09
【问题描述】:
我的 iPhone 应用程序中有以下代码,警告内存泄漏!
这是我的代码
-(IBAction)playVideo:(id)sender {
NSString *filepath = [[NSBundle mainBundle] pathForResource:@"test"
ofType:@"mov"];
NSURL *fileURL = [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:fileURL];
[moviePlayerController.view setFrame:CGRectMake(38, 100, 250, 163)];
[self.view addSubview:moviePlayerController.view];
moviePlayerController.fullscreen = YES;
[moviePlayerController play];
}
这是我收到的错误消息: 在第 37 行分配并存储到“moviePlayerController”中的对象的潜在泄漏
我确实尝试过自动释放“moviePlayerController”,然后尝试释放它。两种情况都解决了内存泄漏问题,但视频无法在 iPhone 上播放!奇怪请帮忙。
【问题讨论】:
标签: iphone objective-c memory-leaks