Changes

Jump to: navigation, search

An iOS 7 In-App Purchase Tutorial

42 bytes added, 20:01, 27 October 2016
m
Text replacement - "<table border="0" cellspacing="0">" to "<table border="0" cellspacing="0" width="100%">"
<googlehtmlet>BUY_IOS7ios9_upgrade</googlehtmlet>
Select File -> New -> File… and create a new Objective-C class named PurchaseViewController subclassed from UIViewController with the With XIB for user interface option selected. Select the PurchaseViewController.xib file and design the layout to match that shown in Figure 86-3, using Label, Text View and Button objects.
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
[[Image:ios_7_in_app_demo_purchase_ui.png|The user interface layout for an iOS 7 in app purchase app]]
}
</pre>
<googlehtmlet>BUY_IOS7ios9_upgrade</googlehtmlet>
When the user decides to purchase Level 2 access, the getProductInfo method of the PurchaseViewController instance will be called by the InAppDemoViewController instance. Passed as an argument to this method will be a reference to the InAppDemoViewController instance which needs to be saved in the previously declared homeViewController property. It will then be the job of the getProductInfo method to contact the App Store and get product information for the specified ID. The code for this belongs in PurchaseViewController.m and reads as follows:
<googlehtmlet>BUY_IOS7ios9_upgrade</googlehtmlet>
 
<htmlet>ezoicbottom</htmlet>
<hr>
<table border="0" cellspacing="0" width="100%">

Navigation menu