iphone - MPMoviePlayerController will play once, then throw an error -
I realized that a similar question has been posted before, but I can not really find a solution that Works . I have a movie player class that keeps a collection of MPMoviePlayerController, and I have the following method in class:
- (zero) playmovie: (NSString *) movieName {NSDream * movieURL; NSBindal * bundle = [NSBindal Main Bundle]; If (bundle) {NSString * moviePath = [Bundle Pathforesource: Type the name of the movie: @ "M4V"]; If (moviepath) {movieURL = [nsur file URLWithPath: moviepath]; }} MPMovieController * mp = [[MPMoviePlayerController alloc] initWithContentURL: movieURL]; If (mp3) {self.moviePlayer = mp; [MP Release]; [Self. Play Movie Player]; } [Movie url release]; }
When I play the movie well once, but when I call it again on a different (or similar) movie file, I get the following error stack when playing the movie Is:
_class_is Initial _class_lookupMethodAndLoadCache objc_msgSend - [Movie Player Setmovie Player] - [Movie Player PLAMAVY]
I'm not sure how to fix it! I assumed that when self.movieplayer = mp is called then the current movie player is released and new is added? Can anyone help if the property is set on (nonatomatic, retaining)?
Thanks
You have released the movie player so it was canceled is.
It seems that you have released it somewhere else in your code, possibly in the call back method. Just look for every example you used it
The movie player now points to garbage. So when you try to create a new movie player, your property excursor tries to send a release message to the garbage stored in the movie player.
If you want to delete the movie player between use, to zero it.
[auto-setmovieplayer: zero];
Then when you try to make one you will not send a message to the trash.
Comments
Post a Comment