Type Method

configure(withAPIKey:appUserID:observerMode:userDefaults:useStoreKit2IfAvailable:dangerousSettings:)

Configures an instance of the Purchases SDK with a custom userDefaults.

Declaration

@discardableResult @objc(configureWithAPIKey:appUserID:observerMode:userDefaults:useStoreKit2IfAvailable:dangerousSettings:) static func configure(withAPIKey apiKey: String, appUserID: String?, observerMode: Bool, userDefaults: UserDefaults?, useStoreKit2IfAvailable: Bool, dangerousSettings: DangerousSettings?) -> Purchases

Return Value

An instantiated Purchases object that has been set as a singleton.

Parameters

apiKey

The API Key generated for your app from https://app.revenuecat.com/

appUserID

The unique app user id for this user. This user id will allow users to share their purchases and subscriptions across devices. Pass nil or an empty string if you want Purchases to generate this for you.

observerMode

Set this to true if you have your own IAP implementation and want to use only RevenueCat’s backend. Default is false.

userDefaults

Custom UserDefaults to use

dangerousSettings

Only use if suggested by RevenueCat support team.

useStoreKit2IfAvailable

EXPERIMENTAL. opt in to using StoreKit 2 on devices that support it. Purchases will be made using StoreKit 2 under the hood automatically.

Discussion

Use this constructor if you want to sync status across a shared container, such as between a host app and an extension. The instance of the Purchases SDK will be set as a singleton. You should access the singleton instance using shared