title: save Capture session in documents directory using swift with avfoundation from device
body: <p>Below snippet i am using  to save video in document directory(NSdata received from AVCaptureMoviefileOutput) </p>
  
  <pre><code>func captureOutput(captureOutput: AVCaptureFileOutput!, didFinishRecordingToOutputFileAtURL outputFileURL: NSURL!, fromConnections connections: [AnyObject]!, error: NSError!) {
      delegate?.recordingStopped?()
  
     var data = NSData(contentsOfURL: outputFileURL)
      let paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
      let documentsDirectory:AnyObject=paths[0]
      let dataPath=documentsDirectory.stringByAppendingPathComponent("/MyFolder")
      if (!NSFileManager.defaultManager().fileExistsAtPath(dataPath)) {
          NSFileManager.defaultManager() .createDirectoryAtPath(dataPath as String, withIntermediateDirectories: false, attributes: nil, error: nil)
      }
  
      var outputPathr = "\(dataPath)/TestproximityRwqxq.mp4"
  
      var success = data!.writeToFile(outputPathr as String, options: nil, error: nil)
  
  }
  </code></pre>
  
  <p>Same code is working in simulator if used for other video (picking video from NSbundle and converting to NSdata), but not working with device,Please help</p>