November 2011
Beginner
238 pages
6h 19m
English
Depending on the complexity of your in-app purchase, it could be very easy or very difficult to integrate it into your code. In UFOs, we have a very simple product, in which paying a one-time fee unlocks a different colored ship. When the user purchases the product, we store a key in our user defaults to reflect that. To unlock this purchase in code, we simply check for that key, and then perform the required steps. To do this, we need to add some new art assets to the project. These have already been included in the Chapter 11 sample code (available at the Apress web site).
After this is done, we need to modify our viewDidLoad method to change the ship's image. The following code snippet shows those changes. ...