却下したいのですUIAlertView
が、奇妙なバグで数日間できません...
のキャンセルボタンをタップすると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
れます。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
and viewDidDisappear
only です。