-1

The application that I am working using the subscription model and validated the receipt get the information it needs to give (or not) the user access to full functionality. I was doing all my initial development using one testing sandbox account.

Now, when I was starting to take the testing from the top again using a fresh sandbox user, I signed out of the initial Apple ID I was working with, and deleted the application from Devices. When I ran the app again and looking at my console debug I was surprised to find that it found the same receipt that was being used by the first Apple ID and started validating it!

What am I missing here? Why is the same receipt being found while I have sign on using a new sandbox test account?

Thanks

mahal tertin
  • 3,239
  • 24
  • 41
Baher A
  • 117
  • 1
  • 5
  • Are you sure you didn't login with the same AppleID into the store again? – Styx Aug 07 '17 at 21:19
  • Yes.. very sure.. tried another Apple ID as well..!!! However, when I purchase something using the 2nd ID, the following receipt validation seems to show a new receipt, but not the "all" the following validations!!! – Baher A Aug 08 '17 at 01:28
  • OK.. Next day, I open the same workspace, plug the phone in for debugging. "Run" the application, and then app asks my for the password (only since it already had the ID).... and what do you know the new receipt is being validated... I currently still don't have a clear idea what was going on last night! did I have to unplug the device?! (that would be strange), or was it a sandbox environment glitch (more probable). To test that I might want to sign in to the first ID again later and see. But not before I finish testing some cases for the application first! – Baher A Aug 08 '17 at 14:25
  • It seems I finally found that the logic had a problem and skipped the "requestDidFinish" callBack of that "SKReceiptRefreshRequest". This meant that it skipped the actual sign in process using the Apple ID. Which also meant that it was not using the wrong receipt during validation. If you are facing this issue, make sure you go through the "didfinish" callBack which means a successful sign in and a successful refresh of ID's receipt. – Baher A Aug 09 '17 at 17:43
  • You can post an answer to your own question and mark it as accepted. This will help out other people with similar issues :) – Kymer Aug 09 '17 at 22:40
  • Thanks for the hint @Kymer – Baher A Aug 10 '17 at 15:55

1 Answers1

0

It seems I finally found that the logic had a problem and skipped the "requestDidFinish" callBack of that "SKReceiptRefreshRequest". This meant that it skipped the actual sign in process using the Apple ID. Which also meant that it was not using the wrong receipt during validation.

If you are facing this issue, make sure you go through the "didfinish" callBack which means a successful sign in and a successful refresh of ID's receipt

Baher A
  • 117
  • 1
  • 5