的錯誤想出了[MPC [ALLOC的MPMoviePlayerController]] [[initWithContentURL:URL]]];它說initWithContentURL是一個未聲明的標識符。我如何解決這個問題?使用未申報indentifier
進口 「ViewController.h」
@interface ViewController()
{
MPMoviePlayerController *mpc;
}
@end
@implementation ViewController
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)playButton:(id)sender {
NSString *stringpath;[[NSBundle mainBundle]pathForResource:@"Lake Weekend September 13-14" ofType:@"m4v"];
NSURL *url = [[[NSURL fileURLWithPath:stringpath]
[mpc [[MPMoviePlayerController alloc]][[initWithContentURL:url]]];
[mpc setMovieSourceType:MPMovieSourceTypeFile];
[[self view ]addSubview:mpc.view];
[mpc setFullscreen:YES];
[mpc play];
}
@end
你在這個指令的最後缺少一個分號(終結者)「NSURL * URL = [[[NSURL fileURLWithPath:stringpath]」 –