私はMPMoviePlayerControllerのフレームを設定しようとしています。しかし、アプリはiOS 3.1.3のplayer.view.frame = CGRectMake (0,0,480,320);
行でクラッシュしていますが、iOS 3.2以上で正常に動作します。何が問題なのでしょうか?iOS 3.1.xのMPMoviePlayerControllerのフレームを設定します
- (void)viewDidLoad {
[super viewDidLoad];
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"aVideo.mp4" ofType:@""]];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:url];
// Register to receive a notification when the movie has finished playing.
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlayBackDidFinish:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayer];
moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
if ([moviePlayer respondsToSelector:@selector(setFullscreen:animated:)]) {
// Use the new 3.2 style API
moviePlayer.repeatMode = YES;
moviePlayer.controlStyle = MPMovieControlStyleEmbedded;
moviePlayer.shouldAutoplay = YES;
[self.view addSubview:moviePlayer.view];
}
else {
Use the old 2.0 style API
moviePlayer.view.frame = CGRectMake (0,0,480,320);
[self.view addSubview: [moviePlayer view]];
moviePlayer.movieControlMode = MPMovieControlStyleDefault;
[moviePlayer play];
}
}
うん... SIGABRT NSObjectのは、私はフレームを設定する行の後にセレクタを認識しません。 – Nithin
上記のコードを投稿できますか?セレクタ?ありがとう。 –
コードを再編集として質問に追加しました。 – Nithin