我只是想解僱UIAlertView
但我不攻可以用奇怪的錯誤了一些日子...崩潰UIAlertViewDelegate的clickedButtonAtIndex有消息[MPMoviePlayerViewController isKindOfClass:]:消息發送到釋放實例
後的取消按鈕UIAlertView
,下面的代碼工作。
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
[alertView dismissWithClickedButtonIndex:buttonIndex animated:YES];
}
但是經過這些行後,它使碰撞與下面的消息:
[MPMoviePlayerViewController isKindOfClass:]: message sent to deallocated instance 0x27f590
在同樣的觀點,我嵌入
MPMoviePlayerViewController.moviePlayer.view
[self.view addSubview:vc.moviePlayer.view];
沒有任何人知道發生了什麼? 我使用ARC,iOS5.1。如果您需要更多信息,我會添加它們。
預先感謝您。
更多信息:
我在我的代碼中的所有方法中設置斷點。 而且我確信,它clickedButtonAtIndex
後崩潰...調用UIAlertView中顯示
代碼
-(void)applicationDidBecomeActive:(NSNotification *)notification
{
self.alert = hoge; // set delegate = self
[self.alert show];
}
美其名曰,viewDidAppear
的調用之後。 有用於enbedding vc.moviePlayer.view
像
MPMoviePlayerViewController *vc;
vc = [[MPMoviePlayerViewController alloc] initWithContentURL:hogeURL];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(finishPreload:)
name:MPMediaPlaybackIsPreparedToPlayDidChangeNotification
object:vc];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(finishPlayback:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:vc];
vc.view.frame = CGRectMake(0, 0, 320, 440);
vc.moviePlayer.allowsAirPlay = YES;
vc.moviePlayer.shouldAutoplay = NO;
vc.moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
vc.moviePlayer.useApplicationAudioSession = NO;
[vc.moviePlayer.view setTag:310];
[self.view addSubview:vc.moviePlayer.view];
我的應用程序代碼有3個標籤,其中2的嵌入MPMoviePlayerViewController.moviePlayer.view
。在其他選項卡的控制器中調用的方法僅爲viewWillDisappear
和viewDidDisappear
。
問題不在於UIAlertView,它是在按下取消按鈕後調用的函數。在你的代碼中輸入一個斷點,並檢查崩潰的位置。並告訴我們你在哪裏啓動MPMoviePlayerViewController,在代碼中你是否使用isKinfOfClass方法檢查是否是MPMovieViewController的實例? – doNotCheckMyBlog
謝謝你的回覆。我在我的問題中添加了更多信息。如果您需要更多信息,請寫下來。對此,我真的非常感激。 – Jagie