If you want a step-by-step understanding of how to create an InAppManager and InAppObserver class, this is the course for you!
If you don't care about creating those classes from scratch and just want to jumpstart into using in-app purchases, this is ALSO the course for you. You're welcome to skip ahead to the Quick Start guide (and copy our InAppManager and InAppObserver classes). You can begin testing purchases or creating an in-game money system within an hour.
Included with the tutorial movies are two source projects, one uses the Sprite Kit template and another uses the starting template for Single View Application. These projects alone make for a valuable reference, but you'll get three hours of tutorials explaining every detail! The source projects have been added to the final movie in the Supplemental Materials tab.
An introduction to this tutorial on consumable and non-consumable purchases and how to initially set them up in iTunes Connect. You can watch this video first or second. It is listed first since its a bit more interesting than the one on Provisioning Profiles.
A quick look at how to create your provisioning profiles and App ID (or Bundle ID) which will need to be specified in the Xcode Project.
A short video on creating a test user in iTunes Connect. You'll use this account to purchase your In-App Products without actually spending money.
In this short lesson we will look at adding your Bundle Identifier to the project and where your Provisioning Profiles reside in the preferences section of Xcode 5.
From here you can choose to follow along, step by step, in creating the InAppManager and InAppObserver class, or you can choose to jump ahead (using the pre-written classes from the example project) and learn how to integrate the classes with the Quick Start videos in Section 3.
In this video we will import the StoreKit framework, create the InAppManager class (and InAppObserver class, though we don't use it yet), then begin to initialize the InAppManager as a singleton. Have your In-App Product ID's ready which you should have already setup in iTunes Connect.
In this tutorial we will populate our purchaseableProducts array with the in-app products from the App Store we created earlier. It is highly recommended you begin testing on your actual device at this point. By the end of this lesson you should receive back data from the store for each product (localized title, price, ID).
In this video we will write the InAppObserver class which is a rather etheric class, used to simply "observe" transactions and call methods based on the result (whether a transaction is restored, completed, or cancelled).
In this video we will write methods in the InAppManager class to handle buying our products and providing content afterwards. NSNotifications will be called (but received later in the Quick Start section) to handle unlocking actual content.
In this tutorial we will finish up our InAppManager class and write the methods used to deal with failed transactions and restoring transactions.
In this video we will import the already-written InAppManager and InAppObserver classes to a different project, then add the StoreKit framework to that new project, as well as initiate the singleton. We will come back to this project later to add buttons to purchase particular products.
In this video we will add extend the InAppManager class to use more product ID's. This is optional viewing if you only have 1 or 2 in-app purchases.
In this tutorial, we will add two UIButtons (to our Sprite Kit scene). Each button can be used to buy the in-app purchase OR make use of it by calling a different method if the purchase has already been bought. We will also vary the button's title if the purchase has already been made or not. And we will receive NSNotifications in this class now to do something when the purchase has been made (or restored).
In this video we will look at styling and placing the buttons differently for the iPhone or iPad.
In this video we will quickly take the UIButton code from the Sprite Kit Based project, and create a new UIView (called AnyOldView), add it from the ViewController and display our purchase screen that way.
In this tutorial we will mostly look at what to do for Consumable purchases, by creating an in-game monetary system. We will create a variable for using purchased "coins", and a hypothetical catalog of products that could be unlocked using those coins. Using the same UIButtons created in the last section, we can purchase multiple increments of 10,000 coins and save our in-game money to the NSUserDefaults to use anytime.
If you plan to sell Non-Consumable purchases be sure to include a Restore button in the project. All this button needs to do is call....
[[InAppManager sharedManager] restoreCompletedTransactions];
...and the rest happens automatically. Your app WILL get rejected with a Restore button though.
Here you can download the source projects for the entire lesson. Included is a version using the Sprite Kit template and another using the template for Single View Application (this one includes a UIView class to contain the UIButtons). The Sprite Kit template has some extra code for handing consumable purchases.
Justin Dike is the founder of CartoonSmart one of the internet's first video training websites. He is a long-time illustrator and animator, focusing mostly on Adobe Flash, and experienced programmer with Swift, Sprite Kit, Actionscript 3, Objective C and Cocos2d. For CartoonSmart he has recorded hundreds of hours of video tutorials and recently published his first full length book titled iOS Programming with Xcode and Cocos2d available in the iBookstore. Justin has also developed many iOS games, including a side scrolling game engine.