This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// PKIAPHandler.swift | |
// | |
// Created by Pramod Kumar on 13/07/2017. | |
// Copyright © 2017 Pramod Kumar. All rights reserved. | |
// | |
import UIKit | |
import StoreKit | |
enum PKIAPHandlerAlertType { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AppDelegate: UIResponder, UIApplicationDelegate, SKPaymentTransactionObserver { | |
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
SKPaymentQueue.default().add(self) | |
//... | |
return true | |
} | |
func paymentQueue(_ queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) { | |
for transaction in transactions { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import StoreKit | |
class MyStoreKitDelegate: NSObject { | |
let monthlySubID = "MyApp.sub.allaccess.monthly" | |
let yearlySubID = "MyApp.sub.allaccess.yearly" | |
var products: [String: SKProduct] = [:] | |
func fetchProducts() { | |
let productIDs = Set([monthlySubID, yearlySubID]) |