Podfile
:use_frameworks!
is added in your Podfile
.Cartfile
:General
tab.observerMode
is true
, Apphud SDK will not finish transactions automatically and will only listen for purchases. If you handle payments by your own code, then set true
. Otherwise, if you purchase products using Apphud.purchase(product){}
method, then you should set observerMode
parameter to false
. Default value is false
.SKProducts
, if configured in Apphud Products Hub. Returns nil
if StoreKit products are not yet fetched from the App Store. To get notified when paywalls are ready to use, use paywallsDidLoadCallback
– when it’s called, paywalls are populated with their SKProducts
.ApphudPaywall
objects. ApphudPaywall
contains the list of products [ApphudProducts]
, paywall’s identifier, and several other properties. To show Products in your app you need to get a Paywall by its identifier.Apphud.paywallShown(paywall)
and Apphud.paywallClosed(paywall)
if you want to show these events in Apphud. We don't track them automatically. Apphud.getPaywalls()
has been deprecated in 2.3.0Apphud.products()
has been deprecated. Use Apphud.getPaywalls
instead.SKProduct
objects upon launch. Make sure products identifiers are added in Apphud products. To get your products call:Apphud.products()
array is nil
at launch. It takes some time to fetch product identifiers from Apphud and later load SKProducts
from StoreKit. To get notified when products are loaded, use any of the following:productsDidFetchCallback(_ callback: @escaping ([SKProduct]) -> Void)
method.didFetchProductsNotification()
notification method.apphudDidFetchStoreKitProducts(
_
products: [SKProduct])
delegate method of ApphudDelegate
.refreshStoreKitProducts(_ callback: (([SKProduct]) -> Void)?)
method. A new request will be sent to the App Store for fetching SKProducts
even if initial request is still loading. So you should only use this method as a fallback in your UI. See Apphud.swift
file for details.ApphudPurchaseResult
object, which contains subscription model with all info about your subscription. ApphudPurchaseResult
may also contain transaction
, error
and nonRenewingPurchase
objects in case user purchased non-renewing purchase. See ApphudPurchaseResult.swift
and ApphudSubscription.swift
files for details.true
if user has active subscription. Use this method to determine whether to unlock premium functionality to the user. ApphudSubscription.swift
file for details.false
if was never purchased or is refunded.SKPaymentQueue.default().restoreCompletedTransactions()
, then you have nothing to worry about: Apphud SDK will automatically intercept and send the latest App Store Receipt to Apphud servers when your restoration is completed. However, better to call our restore method from SDK:nil
, if subscriptions are never purchased), non-renewing purchases (or nil
, if there are no any) and an optional error.ApphudDelegate
method:nil
then a payment will not start; you can also save the product and return nil to initiate a payment later by yourself. You can also read Apple documentation for details.