试图在xcode 4.6.1中添加电影但崩溃

时间:2013-04-12 09:02:37

标签: xcode video

我正在尝试在xcode中添加视频,但崩溃了:[NSURL initFileURLWithPath:]: nil string

(IBAction)Play:(id)sender {

    /////
    NSString *videoUrl=[[NSBundle mainBundle]pathForResource:@"tnween" ofType:@"mov"];

    MPMoviePlayerController *player=[[MPMoviePlayerController alloc]initWithContentURL:[NSURL fileURLWithPath:videoUrl]];
    [player play];
}

1 个答案:

答案 0 :(得分:0)

也许你试试:

NSString *videoUrl=[[NSBundle mainBundle]pathForResource:@"tnween" ofType:@"mov"];
NSURL *url = [NSURL urlWithString:videoUrl];
MPMoviePlayerController *player=[[MPMoviePlayerController alloc]initWithContentURL:url];