title: NSOSStatusErrorDomain Code=-54 for AVAudioPlayer
body: <p>AVAudioPlayer has been giving me the following error on some local MP3 files:</p>
  
  <pre><code>Error Domain=NSOSStatusErrorDomain Code=-54 "(null)"  
  </code></pre>
  
  <p>I'm downloading a zip file to the Documents directory, then unzipping using a library called <a href="https://github.com/ZipArchive/ZipArchive" rel="nofollow">SSZipArchive</a>.</p>
  
  <p>In the Documents directory, a folder is created to contain the unzipped files.</p>
  
  <p>I was able to play entire albums without any issues.
  Everything was going fine until I start downloading certain files. </p>
  
  <p>I've looked for similar questions (osx), possibly stating that this is a permission error, but I haven't managed to make it work.</p>
  
  <p>Does anyone know what this error is?
  It seems to not be on any documentation either.</p>
  
  <p>Ex.</p>
  
  <pre><code>let fileManager = NSFileManager.defaultManager()
  var docDirectory = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)[0]
  
  func showContentsOfSubDirectories() {
      do {
          let files = try fileManager.contentsOfDirectoryAtPath(docDirectory)
          print("----")
          for file in files {
              print("&gt; \(file)")
              do {
                  var rsrc: AnyObject?
                  let possibleDir = NSURL(fileURLWithPath: docDirectory + "/" + file)
                  try possibleDir.getResourceValue(&amp;rsrc, forKey: NSURLIsDirectoryKey)
                  if let isDirectory = rsrc as? NSNumber {
                      if Bool(isDirectory) {
                          let subFiles = try fileManager.contentsOfDirectoryAtPath(docDirectory + "/" + file)
                          for subFile in subFiles {
                              print("  &gt;&gt; \(subFile)")
                          }
                      }
                  }
              } catch let error as NSError {
                  print(error)
              }
          }
          print("----")
      } catch let error as NSError {
          print(error)
      }
  }
  </code></pre>
  
  <p>I use the above code for checking the directory.
  This would give me in debugging:</p>
  
  <blockquote>
    <p>ALBUM NAME</p>
    
    <blockquote>
      <p>SONG1.mp3</p>
      
      <p>SONG2.mp3</p>
      
      <p>SONG3.mp3</p>
      
      <p>SONG4.mp3</p>
    </blockquote>
  </blockquote>
  
  <p>So it exists.</p>
  
  <pre><code>let filePath = docDirectory + "/" + ALBUM_NAME + "/SONG1.mp3"
  //  ~/Library/Developer/CoreSimulator/Devices/XXX/data/Containers/Data/Application/XXX/ 
  // Same issue happens on actual device too
  
  do {
      try player = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: filePath!))
  } catch let error as NSError {
  }
  </code></pre>
  
  <p>This works on some and doesn't on others.</p>