title: Why isn't startDownloadingUbiquitousItemAtURL:fileURL: starting a download of the item?
body: <p>I'm using an <code>NSMetadataQuery</code> to check for files in iCloud.  Inside the <code>NSMetadataQueryDidFinishGatheringNotification</code> handler, if the item isn't downloaded or downloading I start downloading it using <code>startDownloadingUbiquitousItemAtURL:fileURL:</code> - but recently, after using the app on two devices, the documents seem to have got stuck; <code>startDownloadingUbiquitousItemAtURL:fileURL:</code> doesn't kick off a download any more.</p>
  
  <p>Here's an abbreviated form of the code:</p>
  
  <pre><code>    for (NSMetadataItem * result in query.results)
      {   
          NSURL *fileURL = [result valueForAttribute:NSMetadataItemURLKey];
  
          // snipped: checks that the item isn't hidden or already downloaded
  
          if (![fileURL getResourceValue:&amp;isDownloading forKey:NSURLUbiquitousItemIsDownloadingKey error:&amp;error] || !isDownloading)
          {
              NSLog(@"Error %@ getting downloading state for item at %@", error, fileURL);
              continue;
          }
  
          if ([isDownloading boolValue])
          {
              if (![fileURL getResourceValue:&amp;downloadPercent forKey:NSURLUbiquitousItemPercentDownloadedKey error:&amp;error] || !downloadPercent)
              {
                  NSLog(@"Error %@ getting downloaded progress for item at %@", error, fileURL);
                  continue;
              }
  
              NSLog(@"Item at %@ has is %@%% downloaded", fileURL, downloadPercent);
          }
          else
          {
              NSLog(@"Starting to download item at %@", fileURL);
  
              if ([[NSFileManager defaultManager] startDownloadingUbiquitousItemAtURL:fileURL error:&amp;error])
              {
                  isDownloading = nil;
  
                  if ([fileURL getResourceValue:&amp;isDownloading forKey:NSURLUbiquitousItemIsDownloadingKey error:&amp;error] &amp;&amp; isDownloading)
                  {
                      if ([isDownloading boolValue])
                      {
                          NSLog(@"After starting to download, item at %@ is downloading.", fileURL);
                      }
                      else
                      {
                          NSLog(@"After starting to download, item at %@ is still not downloading!", fileURL);
                      }
                  }
                  else
                  {
                      NSLog(@"Error %@ getting downloading state again for item at %@", error, fileURL);
                  }
              }
              else
              {
                  NSLog(@"Error %@ starting to download item at %@", error, fileURL);
              }
          }
      }
  </code></pre>
  
  <p>and what I'm seeing is:</p>
  
  <pre><code>Starting to download item at XXXXXXXX
  After starting to download, item at XXXXXXXX is still not downloading!
  Starting to download item at YYYYYYYY
  After starting to download, item at YYYYYYYY is still not downloading!
  Starting to download item at ZZZZZZZZ
  After starting to download, item at ZZZZZZZZ is still not downloading!
  </code></pre>
  
  <p>Why isn't startDownloadingUbiquitousItemAtURL:fileURL: starting a download of the item?  If it's due to some conflict, how do I detect that conflict?</p>
  
  <hr>
  
  <p>UPDATE: I've had a look at the device console, and I see this:</p>
  
  <pre><code>MyApp[NNNN] &lt;Warning&gt;: Starting to download item at XXXXXXXX
  librariand[MMMM] &lt;Error&gt;: unable to download XXXXXXXX (0x8000000000000000)
  MyApp[NNNN] &lt;Warning&gt;After starting to download, item at XXXXXXXX is still not downloading!
  MyApp[NNNN] &lt;Warning&gt;Starting to download item at YYYYYYYY
  librariand[MMMM] &lt;Error&gt;: unable to download YYYYYYYY (0x8000000000000000)
  MyApp[NNNN] &lt;Warning&gt;After starting to download, item at YYYYYYYY is still not downloading!
  MyApp[NNNN] &lt;Warning&gt;Starting to download item at ZZZZZZZZ
  librariand[MMMM] &lt;Error&gt;: unable to download ZZZZZZZZ (0x8000000000000000)
  MyApp[NNNN] &lt;Warning&gt;After starting to download, item at ZZZZZZZZ is still not downloading!
  </code></pre>
  
  <p>So it looks like at least the daemon is being told to download the file, even though it can't.  Is there any documentation on librariand errors?</p>