如何在我的应用中播放电影?我尝试使用此代码,但xcode给了我这个错误:
NSBundle *bundle = [NSBundle mainBundle];
NSString *moviePath = [bundle pathForResource:@"welcome" ofType:@"mp4"];
NSURL *movieURL = [[NSURL fileURLWithPath:moviePath] retain];
movieView = [[MPMoviePlayerViewController alloc] initWithContentURL: movieURL];
theMovie = [movieView moviePlayer];
theMovie.scalingMode = MPMovieScalingModeAspectFit;
theMovie.fullscreen = TRUE;
theMovie.controlStyle = MPMovieControlStyleNone;
theMovie.shouldAutoplay = TRUE;
[[[UIApplication sharedApplication] keyWindow] addSubview: movieView.view];
ERROR
ld: warning: in /Users/Rushil/Documents/StickDeath/MediaPlayer.framework/MediaPlayer, missing required architecture i386 in file
Undefined symbols:
"_OBJC_CLASS_$_MPMoviePlayerViewController", referenced from:
objc-class-ref-to-MPMoviePlayerViewController in StickDeathViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
答案 0 :(得分:1)
请注意,MPMoviePlayerViewController仅适用于iOS3.2及更高版本
仔细检查,我认为这是问题所在。 More here about MPMoviePlayerViewController