samedi 7 mai 2016

CloudKit sync testing with sandbox users

I'm creating a Mac app that has a non-renewing subscription as an in-app purchase. I want to sync this data to the cloud for the following reasons:

  • I want the user to be able to use the app on all their Macs
  • The in-app purchase enables a widget, so that widget needs to access this data.
  • By Apple's documentation the restoration of non-renewing subscriptions has to be handled by the app by some kind of registration / cloud sync.

So I decided to implement a CloudKit sync to store the following data:

  • Which IAP product did the user purchase (currently only one value, but might change in the future)
  • When did the purchase occur.

Here's what I'm doing now when a user makes an in-app purchase:

  1. I validate the receipt
  2. If I find any IAP data, I sync that to CloudKit
  3. I use a function to fetch the purchase data from CloudKit for the said widget

Question 1: As far as I can tell all the in-app purchases are contained in the receipt file, even after removing and restoring it. I could be using this, however the documentation clearly says I shouldn't. Even the forums are not certain about it... What do you think?

Question 2: While testing the app with multiple sandbox users I noticed that no matter which sandbox user I use to make the purchase, the currently logged in iCloud account (my personal account) gets the receipt data synced to CloudKit. Why isn't the purchaser (App Store) user getting the data to their private cloud database? How can I test that everything works fine? Do I have to log out of my iCloud account to make this work?

Thank you for your time :)

Aucun commentaire:

Enregistrer un commentaire