本地文件的URL IOS

时间:2016-03-18 13:32:03

标签: ios objective-c video nsdata

我尝试了所有我发现的但没有取得好成绩。

Source 1Source 2Source 3

  

我的路径是

recordSession.outputUrl ==> file:///private/var/mobile/Containers/Data/Application/4D4B0147-C52F-469C-AA0A-23D21AA50B5B/tmp/YYEQsKSLMwIl-SCVideo-Merged.mov
recordSession.outputUrl path ===> /private/var/mobile/Containers/Data/Application/4D4B0147-C52F-469C-AA0A-23D21AA50B5B/tmp/YYEQsKSLMwIl-SCVideo-Merged.mov
recordSession.outputUrl pathExtension ===> mov
  

我的代码

NSString *path = [self.recordSession.outputUrl path];
NSData *data = [[NSFileManager defaultManager] contentsAtPath:path];
NSData *data2 = [NSData dataWithContentsOfURL:[NSURL URLWithString:path]];
NSData *videoData = [NSData dataWithContentsOfFile:path];    
NSData *data3 = [[NSData alloc]initWithContentsOfURL:self.recordSession.outputUrl];

NSLog(@"data is ==> %@",data);
NSLog(@"data2 is ==> %@",data2);
NSLog(@"videoData is ==> %@",videoData);
NSLog(@"data3 ==> %@",data3);
  

记录结果

data is ==> (null)
data2 is ==> (null)
videoData is ==> (null)
data3 ==> (null)

0 个答案:

没有答案