title: URLSession dataTask returns with no error and no data, causing SwiftyStoreKit.ReceiptError error 1
body: <p>Why would the following code cause <code>URLSession</code> to return <code>nil</code> for both <code>data</code> and <code>error</code>?</p>
  
  <pre><code>let task = URLSession.shared.dataTask(with: storeRequest as URLRequest) { data, _, error -&gt; Void in
  
      // there is an error
      if let networkError = error {
          print("There was a network error")
          return
      }
  
      // there is no data
      guard let safeData = data else {
          print("No network error, but no data either")
          return
      }
  ...
  </code></pre>
  
  <p>On running this code, one user hits the <code>No network error, but no data either</code> line.</p>
  
  <p>According to Apple's docs on <code>URLSession.dataTask</code>:</p>
  
  <blockquote>
    <p>If the request completes successfully, the data parameter of the
    completion handler block contains the resource data, and the error
    parameter is nil. If the request fails, the data parameter is nil and
    the error parameter contain information about the failure.</p>
  </blockquote>
  
  <p>I read that as: either <code>data</code> or <code>error</code> should always be non-nil. But that doesn't seem to be happening here. <strong>In what situation would both be nil?</strong></p>
  
  <p>(It if helps - the URL in question is the iTunes receipt validation API at <a href="https://buy.itunes.apple.com/verifyReceipt" rel="nofollow noreferrer">https://buy.itunes.apple.com/verifyReceipt</a> and the affected users are the reviewers at Apple, who are generally unwilling to assist in debug. This code is actually part of SwiftyStoreKit and it causes the error <code>SwiftyStoreKit.ReceiptError error 1</code> for the reviewer - but never for anyone else.)</p>