Sungur
Sungur

Reputation: 111

PFPurchase restore implementation Parse

I am using swift for writing a code and used parse for in app purchases. Apple rejected the app for not having a restore purchase button. I am obviously a beginner.

There is a function in parse's PFPurchase as download asset for transaction.

It is like:

PFPurchase.downloadAssetForTransaction(SKPaymentTransaction!, completion: ((String!, NSError!) -> Void)!, progress: PFProgressBlock!)

any ideas how to implement this? The action I want this restore to do is the same as purchase button does which is as follows:

let userDefaults = NSUserDefaults.standardUserDefaults()
userDefaults.setBool(true, forKey: "removeAds")
userDefaults.synchronize()

anyone have suggestions?

Upvotes: 1

Views: 620

Answers (1)

Sungur
Sungur

Reputation: 111

I've found an easier way which is:

PFPurchase.restore()

As simple as that. If you have added an observer for the product, it automatically invokes any commands implemented in it. This is for non-consumable products I guess. Parse is really much more easier for in-app-purchases implementation then using SKPaymentQueues and switches.

Upvotes: 2

Related Questions