私はストーリーボードを使用しています-私はこれにかなり慣れていません-
を指すボタンをクリックすると、 EXC_BAD_ACCESS ( code=2, address = 0x4)MPMoviePlayerViewControllerエラーが発生します。
私がこれまでに得たもののアイデアを提供するために、.h/m によって制御されるナビゲーションを使用しViewControllersて、すべて同じViewController.h/m クラスの下にいくつかの異なるものがありNavigationControllerます。私は aNavControllerと singleから始めて、シンプルな CTRL-Click button-to-new- で new にViewControllerリンクしています。新しい;を追加しました。Identity Inspector の Custom Class セクションでクラスを変更しましたが、ボタンをクリックして移行を開始すると、このエラーが発生し続けます。ViewControllersViewControllerViewControllerMPMoviePlayerViewController
ViewController.h関連する場合の私のコードは次のとおりです。
- (IBAction)postToTwitter:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeTwitter]) {
SLComposeViewController *tweetSheet = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeTwitter];
[tweetSheet setInitialText:@"Check this out!"];
[self presentViewController:tweetSheet animated:YES completion:nil];
}
}
- (IBAction)postToFacebook:(id)sender {
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *controller = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];
[controller setInitialText:@"Posted from IOS App Test -- It works!"];
[self presentViewController:controller animated:YES completion:Nil];
}
}
- (IBAction)playVideo1:(id)sender {
NSURL * url = [[NSURL alloc]initWithString:@"link omitted"];
//create our moviePlayer
moviePlayer = [[MPMoviePlayerController alloc]initWithContentURL:url];
[self.view addSubview:moviePlayer.view];
//Some additional customization
moviePlayer.fullscreen = YES;
moviePlayer.allowsAirPlay = YES;
moviePlayer.shouldAutoplay = NO;
moviePlayer.controlStyle = MPMovieControlStyleDefault;
}