Join Ron Buencamino for an in-depth discussion in this video Persisting purchases, part of Implementing In-App Purchases in iOS 10 with Swift 3.
- [Instructor] When we want to persist a purchase,…we essentially want to keep track…that a purchase has been made for an object in our app.…So, there are a number of ways that we can do this.…One of them is to keep track of these…on our own private web server,…which we can do after the purchase transaction…has been completed.…And this is a good way for us to ensure…that we're keeping things in sync.…Like if we have a game and we're trying to keep track…of how many coins a user purchases,…or how many power-ups they've used.…
Now another way for us to be able to persist a purchase…is by using UserDefaults,…which is a very easy method to do.…If we take a look at DetailViewController,…I'm going to jump down to this function…that I have created here called photoButtonPressed.…Now this function is called whenever the photo icon…is pressed in the DetailViewController.…As we can see here, in line 145,…I'm checking UserDefaults for a key…and the key that we're using is com.notetaker.photonote.…
This is the Photo Note feature…
First, learn what you can legitimately offer for sale in the App Store. Apple's guidelines restrict the sale of certain products, including real-world goods. Next, learn how to configure new products for sale with iTunes Connect and retrieve the product information in your app. Ron then shows how to request and process payments, and deliver the user's purchases to their iOS device. Plus, learn about selling subscriptions and restoring purchased content—a smart strategy for keeping your app rating high.
- What you can and can't sell in the App Store
- Looking at StoreKit
- Creating products in iTunes Connect
- Presenting products in your storefront
- Requesting payments in your app
- Processing transactions
- Delivering products
- Persisting purchases and auto-renewed subscriptions
- Restoring purchased content