2

здесь кодMPMoviePlayerController проблема релиз

- (void)applicationDidFinishLaunching:(UIApplication *)application { 
    NSBundle *bundle = [NSBundle mainBundle]; 
NSString *moviePath = [bundle pathForResource:@"sample_mpeg4" ofType:@"mp4"]; 
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain]; 


MPMoviePlayerController *moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:movieURL]; 
moviePlayer.movieControlMode = MPMovieControlModeHidden; 

[moviePlayer play]; 

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(moviePlaybackDidFinish:) 
name:MPMoviePlayerPlaybackDidFinishNotification 
object:nil]; 

} 
- (void) moviePlaybackDidFinish:(NSNotification*)notification 
{ 

MPMoviePlayerController *theMovie = [notification object]; 
[[NSNotificationCenter defaultCenter] removeObserver:self          name:MPMoviePlayerPlaybackDidFinishNotification 
               object:theMovie]; 
[theMovie stop]; 
[theMovie release]; 

[window addSubview:tabBarController.view]; 
[window makeKeyAndVisible]; 
} 

так что моя проблема в том, мое использование приложений памяти идет дополнительный 3MB, он остается там даже после освобождения, что значит память не освобождается от блокировки?

+0

Я не могу найти ответ на этот вопрос в любом месте – Nnp

+0

через год, вы найдете ответ? – 0xDE4E15B

ответ

1

Посмотрите на свой код в

- (void) moviePlaybackDidFinish:(NSNotification*)notification 
MPMoviePlayerController *theMovie = [notification object]; 
[[NSNotificationCenter defaultCenter] removeObserver:self          name:MPMoviePlayerPlaybackDidFinishNotification            object:theMovie]; 

Вы уверены, что "theMovie" Ваш созданный "MoviePlayer"? Я считаю, что они разные адреса памяти, потому что вы не назначали объект при регистрации уведомления. Убедитесь, что

[[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(moviePlaybackDidFinish:) 
name:MPMoviePlayerPlaybackDidFinishNotification 
object:moviePlayer]; 

Затем повторите попытку.