Apphud v0.9.0 Release Notes

Release Date: 2020-03-09 // about 4 years ago
  • What's new in Apphud SDK 0.9.0:

    • 👌 Support for consumable, non-consumable and non-renewing subscription in-app purchases.
    • ➕ Added new Apphud delegate method func apphudNonRenewingPurchasesUpdated(_ purchases: [ApphudNonRenewingPurchase]). Called when standard in-app purchase is made or has been refunded.
    • 👍 Apple Search Ads attribution support.
    • ➕ Added new method func productsDidFetchCallback(_ callback: @escaping ([SKProduct]) -> Void). Set up a callback block when SKProducts are loaded from the App Store.
    • ➕ Added new method func refreshStoreKitProducts(_ callback: (([SKProduct]) -> Void)?) to force refresh products. Should be used only as a fallback, because Apphud SDK automatically fetched products from the App Store at launch.
    • ➕ Added new class ApphudPurchaseResult, which contains subscription, nonRenewingPurchase, transaction and error properties.
    • 🔄 Changed method func purchase(_ product: SKProduct, callback: ((ApphudPurchaseResult) -> Void)?). Now it returns a new class ApphudPurchaseResult which contains all the necessary data.
    • ➕ Added new method func purchaseWithoutValidation(_ product: SKProduct, callback: ((SKPaymentTransaction, Error?) -> Void)?). This method is just a wrapper method around StoreKit, and it doesn't wait until receipt is validated. It immediately returns SKPaymentTransaction object. Use this if you don't care about validating receipts.
    • Changed method func purchasePromo(_ product: SKProduct, discountID: String, _ callback: ((ApphudPurchaseResult) -> Void)?). Now it returns a new class ApphudPurchaseResult which contains all the necessary data.
    • Method that was deprecated is now completely removed func submitReceipt(_ productIdentifier : String, _ callback : ((ApphudSubscription?, Error?) -> Void)?). Apphud SDK automatically submits App Store receipts to Apphud.
    • ➕ Added new method func nonRenewingPurchases() -> [ApphudNonRenewingPurchase]? which returns array of standard in-app purchases, if there are any.
    • ➕ Added new class ApphudNonRenewingPurchase which contains product identifier, purchase date and and optional cancellation date.
    • ➕ Added new method func isNonRenewingPurchaseActive(productIdentifier : String) -> Bool. Returns true if current user has purchased standard in-app purchase with given product identifier. Returns false if this product is refunded or never purchased.
    • ⏪ Method restoreSubscriptions renamed to func restorePurchases(callback: @escaping ([ApphudSubscription]?, [ApphudNonRenewingPurchase]?, Error?) -> Void). Added new callback parameter [ApphudNonRenewingPurchase]?, which returns array of standard in-app purchases, if there are any.
    • Method migrateSubscriptionsIfNeeded renamed to func migratePurchasesIfNeeded(callback: @escaping ([ApphudSubscription]?, [ApphudNonRenewingPurchase]?, Error?) -> Void). Added new callback parameter [ApphudNonRenewingPurchase]?, which returns array of standard in-app purchases, if there are any.
    • ➕ Added new method func setFinishAllTransactions(). Using this method Apphud SDK will finish all pending transactions, not only those that were started by Apphud SDK. See Apphud.swift for details.
    • Apphud SDK now tries to re-register user, re-fetch products and re-submit receipts when application becomes active if there were errors on app launch; for example, if there was no Internet connection.

    Migration guide to 0.9.0:

    • ⚡️ Update pod using terminal: pod update ApphudSDK
    • ⚡️ Update method from Apphud.purchase(product) { (subsription, error) in ...} to Apphud.purchase(product) { result in ...}. You will find subscription and error objects inside new ApphudPurchaseResult object.
    • ⚡️ Update method from Apphud.purchasePromo(product, discountID: promoID) { (subsription, error) in ...} to Apphud.purchasePromo(product, discountID: promoID) { result in ...}. You will find subscription and error objects inside new ApphudPurchaseResult object.
    • ⚡️ Update method from Apphud.restoreSubscriptions { subscriptions, error in ...} to Apphud.restorePurchases { subscriptions, purchases, error in ...}.
    • ⚡️ Update method from Apphud.migrateSubscriptionsIfNeeded { subscriptions in ...} to Apphud.migratePurchasesIfNeeded { subscriptions, purchases, error in ...}.