title: iOS Receipt not found
body: <p>I am implementing in-app purchases in a Swift 3.0 app so I need to grab the app receipt to verify it against the iTunes store. Here is how I am getting the receipt:</p>
  
  <pre><code>func getReceipt() -&gt; Data? {
      if Bundle.main.appStoreReceiptURL != nil {
          print("app receipt: \(Bundle.main.appStoreReceiptURL)")
          do {
              let receiptData = try Data(contentsOf: Bundle.main.appStoreReceiptURL!)
              print(receiptData)
              return receiptData
          } catch {
              print("error converting receipt to Data: \(error.localizedDescription)")
          }
      }
      return nil
  }
  </code></pre>
  
  <p>my console output for the receipt URL is:</p>
  
  <blockquote>
    <p>app receipt: Optional(file:///Users/dustinspengler/Library/Developer/XCPGDevices/433E8E8F-B781-4ADC-A92D-5CABC28E94D6/data/Containers/Data/Application/C25BE9B6-FB64-4D49-9CF2-9DA371060A7B/StoreKit/receipt)</p>
  </blockquote>
  
  <p>It then failed to convert the receipt to <code>Data</code> and the catch statement prints:</p>
  
  <blockquote>
    <p>error converting receipt to Data: The file “receipt” couldn’t be opened because there is no such file.</p>
  </blockquote>
  
  <p>I get the exact same output when running this in a playground, simulator, and real devices so <strong>does this mean that no receipt exists for the app considering the fact that the user has not made an in-app purchase yet?</strong> When reading through Apple's <a href="https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1" rel="nofollow noreferrer">documentation</a> I got the impression that they are always created created regardless of prior purchases.</p>