このチュートリアルリンクをたどろうとしていますが、問題があります。誰かが見て、何を変更する必要があるか教えてください。他の例を調べてみましたが、どれもうまくいかないようです。何を変更する必要があるか教えてください。
以下はエラーです
アーキテクチャi386の未定義のシンボル: "_ OBJC_CLASS _ $ _ MPMoviePlayerController"、参照元:VideoScreenViewController.oのobjc-class-ref "_MPMoviePlayerPlaybackDidFinishNotification"、参照元:-[VideoScreenViewController playVideo:] in VideoScreenViewController.o-[VideoScreenViewController moviePlayBackDidFinish:] in VideoScreenViewController o ld:アーキテクチャi386のシンボルが見つかりませんclang:エラー:リンカーコマンドが終了コード1で失敗しました(呼び出しを確認するには-vを使用してください)
これがコードです
// VideoScreenViewController.h
#import <UIKit/UIKit.h>
#import "MediaPlayer/MediaPlayer.h"
@interface VideoScreenViewController : UIViewController
@property (strong, nonatomic) MPMoviePlayerController *moviePlayer;
- (IBAction)playVideo:(id)sender;
@end
}
#import "VideoScreenViewController.h"
#import "MediaPlayer/MediaPlayer.h"
@interface VideoScreenViewController ()
@end
@implementation VideoScreenViewController
@synthesize moviePlayer;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
self.view.backgroundColor = [UIColor clearColor];
[super viewDidLoad];
// Do any additional setup after loading the view.
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
- (IBAction)playVideo:(id)sender {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Movie" ofType:@"MOV"]];
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];
}
- (void) moviePlayBackDidFinish:(NSNotification*)notification {
NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle]
pathForResource:@"Movie" ofType:@"MOV"]];
MPMoviePlayerController *player = [[MPMoviePlayerController alloc] initWithContentURL:url];
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
object:player];
if ([player
respondsToSelector:@selector(setFullscreen:animated:)])
{
[player.view removeFromSuperview];
}
}
@end