Today you will perform pre In-App Purchased tasks shown on this card.

Before, you get started, I assume you read part 1 of the tutorial and you created a new branch called part2 from the master branch.

Task 1

Since you’ll be implementing code in the Nifty-IAP application to enable the user to purchase Non-Consumable products within the Nifty-IAP application’s app store (Nifty app store for short); you’ll have to switch on In-App Purchase.

With that said, launch the Nifty-IAP application in Xcode and select the application name from the top of the project navigator panel. Click the Capabilities tab and switch on In-App Purchase.

Figure 2-1

When you switch on In-App Purchase, Xcode ask you to select the Development Team to use for the  provisioning profile. Go ahead and select your name from the drop down menu and click the Choose button.

Figure 2-2

Notice that Xcode added the StoreKit framework in the Nifty-IAP application. Soon enough you’ll learn how to use it to implement tasks that’s on the third card, in the app.

Figure 2-3

Xcode also registered the Nifty-IAP application’s explicit App ID in the iOS provisioning portal. In my case, it is this: net.theapplady.Nifty-IAP. You can verify this by doing the following in Xcode.

Select Preferences... from Xcode menu. Select the Accounts tab in the Preferences window that appear on your screen.

Figure 2-4

Click the View Details… button and you should see the explicit app identifier in the Provisioning Profiles of the window that appear on your screen. If not, click the Download All button. When you are done, click the Done button and close the Preferences window.

Figure 2-5

Task 2

Every product you will sell in the Nifty app store has a unique product identifier. The Nifty app store uses these product identifiers to fetch information about products from Apple’s App Store, such as pricing, and to submit payment requests when a user tap a Buy Now button in the Nifty app store.

The Nifty app store can either read its list of product identifiers from a file that’s embedded in its app bundle or fetch them from your server. We will go with the first option because the Nifty app store has a fixed list of products. Besides, the first option is recommend by Apples’s In-App Purchase Programming Guide.

With that said, here are the steps to add plist file called product_ids.plist in the Nifty-IAP app bundle:

  1. At the bottom of project navigator click the + icon and select File.. from the pop menu
  2. In the left panel, select Resources from the iOS menu
  3. In the right panel, select Property List and click Next
  4. In the Save As field, enter product_ids.plist and click Create

Task 3

What you have to do now is add product identifiers shown in the image below, in the product_ids.plist file. Save changes you made to the plist file.


Task 4

Later on in the tutorial series, you’ll implement several iOS keychain tasks in the Nifty application. So now is a good time to point your browser to this GitHub page and click the Download Zip link.


In Finder, unzip the file you downloaded then drag-and-drop the KeychainSwiftDistrib.swift file in the project navigator.


In the file option window that appear on your screen, tick the Copy items if needed checkbox and click the Finish button.


Task 5

This is the last task on the card presented at the beginning of todays’s tutorial. It says that you have to add an entry in the Info.plist file. The entry you will be adding in the plist file will make an exception for the video files hosted on domain.

The image below highlight the entry to add in the Info.plist file. Save changes you made to the Info.plist file.


That’s all for today. Use Xcode’s Source Control ▶︎ Commit command to commit changes you made to the project in the Git repository. Next week you get started on tasks that are on the second card.


No responses yet

Leave a Reply

UIDocument Demystified: A Step-by-step Guide on Local and iCloud Document Storage