当我单击按钮时,我在飞行模式下在 iPhone 上测试此代码显示一条消息,但是在我连接到互联网的状态下,播放按钮不起作用并且我的应用程序退出
这是代码:
-(void)playMovie {
NSURL *url = [NSURL URLWithString:@"http://www.tvlaayoune.com/iphone/jt.mp4"];
UIAlertView *errorView;
if ([[Reachability sharedReachability]
internetConnectionStatus] == NotReachable) {
errorView = [[UIAlertView alloc]
initWithTitle: @"Unable To Connect To Server"
message: @"Check your network connection and try again."
delegate: self
cancelButtonTitle: @"OK"
otherButtonTitles: nil];
} else {
moviePlayer = [[MPMoviePlayerController alloc]
initWithContentURL:url];
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.controlStyle = MPMovieControlStyleDefault;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES animated:YES];
} [errorView show];
}
可能是什么问题?