Add In-App Purchase Support to the Project

Similar to what you did in Chapter 18, Using Ads to Increase Revenue, you’ll use helper files to integrate in-app purchases. You’ll also use a pre-built scene to speed up development.

Open Finder and drag the IAP folder from the resources folder into the Project Navigator; place it below the AdMobHelper.swift file, like so:

images/MonetizingYourGamesWithInAppPurchases/iap-add-group.png

Don’t forget to verify that the Copy items if needed and Add to targets options are both checked. Also verify that the option to Create groups is selected. Once confirmed, click the Finish button to add the contents of the folder to your project.

Back in Xcode, open the IAP group and have a look around. You’ll see the following new files:

  • ShopScene.sks
  • ShopScene.swift
  • StoreManager.swift
  • StoreProducts.swift

You’ll learn more about each of these files as you work through the rest of this chapter. The first stop on this tour, however, is the StoreProducts.swift file, which is the file you’ll use to configure the products.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.45.253