皆さん、iOS 5でビデオを再生する際に問題が発生しました。プログラムをビルドするときに、「インスタンス変数を非表示にする」という警告が表示され、プログラムを実行してボタンをタップします私は "SIGABRT"を取得します。そして、私は何をすべきかわからない、私が得ることができるすべての助成金はaprriciatedです!iOS 5ムービープレーヤー
事前にThxを
MY .hファイル
#import <MediaPlayer/MediaPlayer.h>
@interface MainViewController : UIViewController {
MPMoviePlayerController *moviePlayer;
}
-(IBAction)Video:(id)sender;
@end
MY .mファイル
#import "MainViewController.h"
@interface MainViewController()
@end
@implementation MainViewController
-(IBAction)Video:(id)sender {
MPMoviePlayerController *moviePlayer;
NSString *path = [[NSBundle mainBundle] pathForResource:@"big-buck-bunny-clip" ofType:@"m4v"];
NSURL *videoURL = [NSURL fileURLWithPath:path];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[moviePlayer setControlStyle:MPMovieControlStyleDefault];
[moviePlayer.view setFrame: self.view.bounds];
[self.view addSubview: moviePlayer.view];
[moviePlayer prepareToPlay];
[moviePlayer play];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
}
@end