2013-10-05 1 views
0

[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 
+0

당신은이 명령의 끝에 세미콜론 (터미네이터) 누락을 "NSURL * URL = [[[NSURL fileURLWithPath는 : stringpath]" –

답변

0

당신은 그것을 사용하기 전에 URL을 선언하지 않은? 그런 다음 URL을 사용할 수 있습니다 .. 당신은 적어도 첫 번째 줄 이후에 세미콜론이 있어야합니다 ... 그것의 선언 내에서 그것을 사용하는

NSURL *url = [[[NSURL fileURLWithPath:stringpath] 
[mpc [[MPMoviePlayerController alloc]][[initWithContentURL:url]]]; 

을 시도하고 있습니다. 게다가 당신은 추가 브래킷을 정렬해야합니다. 이걸 시도해보십시오.

NSURL *url = [NSURL fileURLWithPath:stringpath]; 
mpc = [[MPMoviePlayerController alloc]initWithContentURL:url]; 
+0

어떻게 그것을 선언 ? – Nick

+0

NSURL * url = [[[NSURL fileURLWithPath : stringpath]; [mpc [[MPMoviePlayerController alloc]] [[initWithContentURL : url]]]; // 세미 콜론에 주목해라 .. –

0

mpc의 할당/초기화가 모두 잘못되었습니다. 그 줄은 모두 나에게 왜곡되어 보인다. 내가 그 선이 같은 읽어야한다고 생각 :

mpc=[[MPMoviePlayerController alloc] initWithContentURL: url];