I have the following code in my iPhone application, warning memory leak!
This is my code
-(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];
}
This is the error message I'm getting: Potential leak of an object allocated on line 37 and stored into 'moviePlayerController'
I did try to autorelease "moviePlayerController" and then I try to release it. Both cases memory leak was solved but the video didn't play on the iPhone! Strange please help.