我只是想解雇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 个是 embed MPMoviePlayerViewController.moviePlayer.view
。在其他选项卡的控制器中调用的方法是viewWillDisappear
且viewDidDisappear
唯一的。