[mpc [[MPMoviePlayerController alloc]][[initWithContentURL:url]]] 出现错误;它说 initWithContentURL 是一个未声明的标识符。我该如何解决?
导入“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