我在我的iPhone應用程序中有以下代碼,警告內存泄漏!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」
我對象的潛在泄漏嘗試autorelease「moviePlayerController」然後我嘗試釋放它。這兩種情況下內存泄漏都已解決,但視頻無法在iPhone上播放!奇怪請幫忙。
可能重複的[如何釋放MPMoviePlayerController?](http://stackoverflow.com/questions/695307/how-to-release-mpmovieplayercontroller) – albertamg