Skip to main content
Question

Runs really slow on IOS and not correctly?

  • November 15, 2023
  • 1 reply
  • 90 views

Forum|alt.badge.img+1

Can anyone explain if I am doing this correctly?

 

It seems to work fine on Android, but on IOS it takes at least 10 seconds for the Apple confirm dialogue to appear, and then after confirming purchase (in sandbox) it then pops up again and never gets to the alert and redirection?

 

```

useEffect(() => {
    (async function () {
      await Purchases.setLogLevel({ level: LOG_LEVEL.INFO }); // Enable to get debug logs
      await Purchases.configure({
        apiKey: "XXX"
      });
    })();
  }, []);

 

const purchaseStoreProductA = async () => {

const offerings = await Purchases.getOfferings();

const productToBuy = offerings.current

&& offerings.current.availablePackages

&& offerings.current.availablePackages[0].product;

if (productToBuy == null) {

alert('No product');

return

};

const purchaseResult = await Purchases.purchaseStoreProduct({

product: productToBuy

});

 

purchaseResult ? alert('Thank you for subscribing.') + history.push("/ios-signup/") : null;

}

```

I call purchaseStoreProductA() from a button.

1 reply

sharif
RevenueCat Staff
Forum|alt.badge.img+9
  • RevenueCat Staff
  • 513 replies
  • November 17, 2023

Hello,

It sounds like something is happening after you attempt to make the purchase. If you build and run the app from Xcode you will see the debug logs which may indicate any errors that happen after the purchase. Can you share them here when you get them?


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings