我正在尝试在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];
}
答案 0 :(得分:0)
也许你试试:
NSString *videoUrl=[[NSBundle mainBundle]pathForResource:@"tnween" ofType:@"mov"];
NSURL *url = [NSURL urlWithString:videoUrl];
MPMoviePlayerController *player=[[MPMoviePlayerController alloc]initWithContentURL:url];