Created
December 30, 2020 01:06
-
-
Save rkotzy/7206285a01d6c2eb4ab821096983cddf to your computer and use it in GitHub Desktop.
This file contains 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 Purchases | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
func application(_ application: UIApplication, | |
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | |
Purchases.configure(withAPIKey: "<your_api_key>") | |
Purchases.shared.delegate = self // set up the delegate | |
return true | |
} | |
} | |
extension AppDelegate : PurchasesDelegate { | |
func purchases(_ purchases: Purchases, didReceiveUpdated purchaserInfo: Purchases.PurchaserInfo) { | |
// Broadcast a notification when the PurchaserInfo changes | |
NotificationCenter.default.post(name: NSNotification.Name("kPurchaserInfoUpdated"), object: nil) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment