From the course: Implementing In-App Purchases in iOS 11 with StoreKit

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Restoring purchases

Restoring purchases

From the course: Implementing In-App Purchases in iOS 11 with StoreKit

Start my 1-month free trial

Restoring purchases

- [Instructor] There will be times where your users need to reinstall your app either they experienced a bug where the fix is to reinstall or they just chose to uninstall it and later on will decide to reinstall it. Whatever the case, if a user purchases something that they expect to continue to have around, like for instance a filter for their app, then they would be a bit disappointed if they went back to your app and wasn't able to restore their previous purchase. Lucky for us, Apple makes this real easy. All we need to do is come over here to IAP Manager and let's come down to the bottom of our class and we're going to mark off a section for restoring purchases. I'm going to create a function called restorePreviousPurchases. In here, I'm simply going to call SKPaymentQueue, the default queue, and in there they have a function called restoreCompletedTransactions and what this does is it goes to the App Store and it downloads the latest receipt and it gives you that receipt so that…

Contents