Type Method
configure(withAPIKey:appUserID:observerMode:userDefaults:)
Configures an instance of the Purchases SDK with a custom UserDefaults
.
Declaration
@discardableResult @objc(configureWithAPIKey:appUserID:observerMode:userDefaults:) static func configure(withAPIKey apiKey: String, appUserID: String?, observerMode: Bool, userDefaults: UserDefaults?) -> 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
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