In-App Purchasing with iOS 7- Consumable and Non-Consumables
4.5 (36 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
6,124 students enrolled
Wishlisted Wishlist

Please confirm that you want to add In-App Purchasing with iOS 7- Consumable and Non-Consumables to your Wishlist.

Add to Wishlist

In-App Purchasing with iOS 7- Consumable and Non-Consumables

Earn money from iOS game or app by integrating In-App purchases. Sell coins to unlock features or allow simple upgrades.
4.5 (36 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
6,124 students enrolled
Created by Justin Dike
Last updated 10/2013
English [Auto-generated]
Price: Free
  • 3 hours on-demand video
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Setup either a Consumable or Non-Consumable In-App Purchase in any of your iOS Projects (Sprite Kit included)
View Curriculum
  • Basic understanding of Xcode is preferred but not required.

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.

Who is the target audience?
  • Any iOS Developer
Compare to Other iOS Development Courses
Curriculum For This Course
18 Lectures
iTunes Connect Setup and Provisioning
5 Lectures 24:04

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.

iTunes Connect Setup (viewable first or second)

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.

Provisioning Profiles (viewable first or second)

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.

Creating an iTunes Connect Test User

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.

Initial Xcode Setup

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.

Two Paths from here: Quick Start or Write the In-App Purchasing from Scratch
Write the In-App Purchasing Classes from Scratch
5 Lectures 01:12:52

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.

Initializing the InAppManager Class

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).

Requesting Product Data (Test on Your Device)

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).

The InAppObserver Class

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.

The Buy Products and Provide Content Methods

In this tutorial we will finish up our InAppManager class and write the methods used to deal with failed transactions and restoring transactions.

Failed and Restored Transactions
Quick Start Guide to using the In-App Purchases Classes
5 Lectures 54:56

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.

Adding the (pre-written) InAppManager and InAppObserver Classes to your project

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.

Adding More Product ID's to Purchase

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).

Adding UIButtons to Purchase and Getting NSNotification feedback

In this video we will look at styling and placing the buttons differently for the iPhone or iPad.

Setting Different Button Values for the iPhone and 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.

Using a UIView for the UIButtons (instead of a Sprite Kit Scene)
What To Do After a Purchase.
3 Lectures 23:57

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.

Creating an In-Game Monetary System for Consumable Purchases

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.

Don't Forget the Restore Button (I almost did!)

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.

The Source Projects
About the Instructor
Justin Dike
4.3 Average rating
635 Reviews
42,688 Students
24 Courses
CartoonSmart / Owner / Leader Developer and Instructor

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.