0

I'm retrieving the receipt on my users device using the following code:

let receiptUrl = NSBundle.mainBundle().appStoreReceiptURL

I then check to see what the value of receiptURL is by using:

print("receiptUrl is \(receiptUrl)")

My console displays the location as:

receiptUrl is Optional(file:///private/var/mobile/Containers/Data/Application/018CF51F-1F55-465B-AA98-B4AD5A864E06/StoreKit/sandboxReceipt)

I then use an if statement:

if NSFileManager.defaultManager().fileExistsAtPath(receiptUrl!.path!)
    { //do great security stuff
    }

However, my fileExistsAtPath always returns as false. Very frustrating.

Tom
  • 790
  • 2
  • 9
  • 32

1 Answers1

0

It's right result may be. appStoreReceiptURL doesn't show exist path. Just show store receipt folder will be there. this answer relative with this

Community
  • 1
  • 1
oozoofrog
  • 166
  • 9
  • Thanks for the suggestion Jay. I had a look but still cannot get the above to evaluate to true even though there seems to be a file. I think it may be a file permissions problem. It's as if I don't have the right permissions to open that particular folder but I need to retrieve the receipt to validate. – Tom Aug 14 '16 at 14:41
  • [here](http://stackoverflow.com/questions/24591415/appstorereceipturl-error) should be answer for your question. – oozoofrog Aug 14 '16 at 14:45