0

我正在尝试在 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];
}
4

1 回答 1

0

也许如果你尝试:

NSString *videoUrl=[[NSBundle mainBundle]pathForResource:@"tnween" ofType:@"mov"];
NSURL *url = [NSURL urlWithString:videoUrl];
MPMoviePlayerController *player=[[MPMoviePlayerController alloc]initWithContentURL:url]; 
于 2013-04-12T09:08:02.407 回答