title: NSData from local file's URL IOS
body: <p>I tried everything I have found but did not get good results.</p>
  
  <p><a href="https://stackoverflow.com/questions/1514343/iphone-nsdata-from-local-files-url">Source 1</a>, <a href="https://stackoverflow.com/questions/11009508/how-to-convert-video-path-to-nsdata">Source 2</a>, <a href="https://stackoverflow.com/questions/23198644/convert-nsdata-from-local-nsurl">Source 3</a></p>
  
  <blockquote>
    <p>My path is </p>
  </blockquote>
  
  <pre><code>recordSession.outputUrl ==&gt; file:///private/var/mobile/Containers/Data/Application/4D4B0147-C52F-469C-AA0A-23D21AA50B5B/tmp/YYEQsKSLMwIl-SCVideo-Merged.mov
  recordSession.outputUrl path ===&gt; /private/var/mobile/Containers/Data/Application/4D4B0147-C52F-469C-AA0A-23D21AA50B5B/tmp/YYEQsKSLMwIl-SCVideo-Merged.mov
  recordSession.outputUrl pathExtension ===&gt; mov
  </code></pre>
  
  <blockquote>
    <p>My Code</p>
  </blockquote>
  
  <pre><code>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 ==&gt; %@",data);
  NSLog(@"data2 is ==&gt; %@",data2);
  NSLog(@"videoData is ==&gt; %@",videoData);
  NSLog(@"data3 ==&gt; %@",data3);
  </code></pre>
  
  <blockquote>
    <p>Logs Result</p>
  </blockquote>
  
  <pre><code>data is ==&gt; (null)
  data2 is ==&gt; (null)
  videoData is ==&gt; (null)
  data3 ==&gt; (null)
  </code></pre>