1 NSError *error = nil; 2 NSData* videoData = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.recordFilePath] options:0 error:&error]; 3 if (nil == videoData || videoData.length <= 0) 4 { 5 videoData = [NSData dataWithContentsOfFile:self.recordFilePath options:0 error:&error]; 6 } 7 if (videoData.length <= 0 ) 8 { 9 return; 10 } 11
第一个if之前的代码会报错,
(lldb) po error Error Domain=NSCocoaErrorDomain Code=256 "未能完成操作。(“Cocoa”错误 256。)" UserInfo=0x174666740 {NSURL=/var/mobile/Containers/Data/Application/FBF2584C-7428-4709-A2F2-80CBD91B6A40/Documents/1.mp4}
百思不得姐,换用第二个OK了
留待来日在做处理吧