Solved

Cordova error on capacitor: Purchases has not been configured

  • 26 May 2023
  • 1 reply
  • 17 views

Badge +4

I’m upgrading an old project (Ionic with Capacitor 5) from cordova-plugin-purchases 2.3.2 to the latest 3.13.0. I’m calling configureWith using a valid API key and user id, and 10 seconds later, I call getOfferings() and get a fatal error in xcode:

PurchasesHybridCommon/CommonFunctionality.swift:21: Fatal error: Purchases has not been configured. Please configure the SDK before calling this method

UPDATE:

I should have read the configureWith docs more carefully - I was calling it in the same style as Purchases.configure(apiKey, appUserId). Changing it Purchases.configureWith({apiKey, appUserId}) solves the problem!  Leaving this here in case anyone else makes the same mistake. 🤦🙂

icon

Best answer by Haley Pace 31 May 2023, 21:46

View original

1 reply

Userlevel 2
Badge +7

Hi,  yes you want to make sure you are calling configureWith. The only other thing that may cause this error is if the Purchases object is null.

Reply