Search code examples
iosswiftin-app-purchasein-app-billing

RestorePurchases() hangs forever on iOS 16


When I run,

InAppPurchase.instance.restorePurchases()

there is no result, no success and no failure. None of the observer is getting called.

Doesn't work on iOS 16, It is working fine on iOS 15 and below.


Solution

  • Here is the detailed case after long debugging.

    On iOS 16.0.2 there is a problem with the delegates of SKProductsRequestDelegate and SKPaymentTransactionObserver they don't get the callbacks. If anyone is observing and has the iOS version 16.0.2 the delegates will never get called. The same code is working fine on older devices than iOS 16, iOS 16.1.2, and iOS 16.3.1 (I have tested on these devices).

    1. Solution #1: Update to the latest iOS (16.3.1 or maybe 16.1.2).
    2. Solution #2: Place a timeout for 15 - 20 seconds so that if a delegate doesn't respond then consider that the above 2 delegates are not working and handle this timeout case.