CocoaPods trunk is moving to be read-only. Read more on the blog, there are 14 months to go.
| TestsTested | ✗ |
| LangLanguage | Obj-CObjective C |
| License | MIT |
| ReleasedLast Release | Oct 2016 |
Maintained by Mattias Eriksson.
In App Purchase controller
pod 'IAPController'pod 'IAPController/Swift'pod 'IAPController/ObjC'Create a plist-file named IAPControllerProductIds.plist that contains the identifiers of your in-app purchases:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<string>com.thematerik.IAPController.product1</string>
<string>com.thematerik.IAPController.product2</string>
</array>
</plist>Fetch the products in the didFinishLaunchingWithOptions method in your AppDelegate:
IAPController.sharedInstance.fetchProducts()Use observers to listen to in-app purchases events:
IAPControllerFetchedNotification: when the products have been fetched from the storeIAPControllerPurchasedNotification: when a product have been purchasedIAPControllerFailedNotification: when a transaction could not be finishedIAPControllerRestoredNotification: when the user restored his in-app purchasesSKProduct have been given some useful helper methods, example:
if let product = IAPController.sharedInstance.products?.first {
// Printing the price of the product
print(product.priceFormatted)
// Buying the product
product.buy()
}Restore purchases by calling:
IAPController.sharedInstance.restore()The same API call works for Objective-C as well