Question

Runs really slow on IOS and not correctly?

  • 15 November 2023
  • 1 reply
  • 68 views

Badge

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

Userlevel 5
Badge +9

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