I am creating an application in which I have an in-app purchase function. I am using a non-renewable type of subscription, but I must provide support for restoring a subscription on multiple devices.
After going through several documents, I found out that iCloud was the best way to implement it and provide subscribed content for multiple user devices. Finally, I decided that the following project would be implemented:
User explores the application.Click on the in-app purchase buttonCheck iCloud AvailabilityICloud Available:Continue the purchase as usual.iCloud is not available:Show alert: "Sign in to iCloud to access signed content on another device," with the options "OK" and "Continue Anyway"Click OK:Remains on the same pageClick Continue Anyway:Purchase in progressIf iCloud is already purchased and available, upgrade to iCloudOn a successful purchase, we receive a transaction. We will store this receipt in iCloud (one time in iCloud at the time of purchase) using the key value storage, as well as the default for usersSuccessful purchase.The user starts the application from another deviceCheck receipt of a transaction in user defaults. If available, check and act accordingly.If the receipt is not available to users by default, check for iCloudiCloud:,, . ,, .iCloud :: ", iCloud, , " """ HD",
Check iCloud Availability
ICloud Available:
iCloud is not available:
Show alert: "Sign in to iCloud to access signed content on another device," with the options "OK" and "Continue Anyway"
Click OK:
Click Continue Anyway:
On a successful purchase, we receive a transaction. We will store this receipt in iCloud (one time in iCloud at the time of purchase) using the key value storage, as well as the default for users
Successful purchase.
The user starts the application from another device
If the receipt is not available to users by default, check for iCloud
iCloud:
iCloud :
:
, , , iCloud , , //. .
, , . , .
, iCloud NSUbiquitousKeyValueStore ( , NSUserDefaults), IAP. Github, MKiCloudSync, , .
NSUbiquitousKeyValueStore
NSUserDefaults
NSUbiquitousKeyValueStore, , iCloud iDevices. , - 2 , 1 iCloud, 2 , 2.