In-App-Purchase takes too long time to show confirmation alert view

后端 未结 3 597
眼角桃花
眼角桃花 2021-02-14 10:33

I have encountered the following issue: when my app runs on a device and I tap BUY button, which triggers In-App-Purchase mechanism it takes up to ten seconds to show the standa

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-14 11:07

    This should have nothing to do with what an actual user experiences when they try to make the purchase. This is happening because you're running the app in the sandbox environment. In fact, using the simulator makes it even slower.

    However, even when an actual user does make the purchase, the phone has to connect to Apple's servers, find the IAP, and then send the IAP data to the device securely. So, as you could imagine, it is normal that there is a little time before a confirmation message is sent back.

    I recommend adding a loading screen in the SKPaymentTransactionStatePurchasing method, telling the user that you are in fact fetching the information. This could be as simple as changing the "Purchase" button to say "Purchasing...".

    Again, this is 100% normal what you are seeing, but is mostly because you're using the sandbox and/or simulator. Apple has to do a lot of checks, and verify a lot of things before it can send back a confirmation message, so you should expect at least some minor delay (as if you were fetching information from a website).

提交回复
热议问题