adaptyteam / AdaptySDK-Flutter

SDK for growing mobile in-app purchases
https://docs.adapty.io/docs/quickstart
MIT License
96 stars 17 forks source link

Calling restorePurchases and after that calling makePurchase doesn't return anything #74

Closed UlasKasim-dusyeri closed 1 year ago

UlasKasim-dusyeri commented 1 year ago
Future<AdaptyProfile> restorePurchase() async {
    try {
      AdaptyProfile results = await Adapty().restorePurchases();
      return results;
    } on AdaptyError catch (_) {
      rethrow;
    } catch (expection) {
      rethrow;
    }
  }

  Future<AdaptyProfile?> purchase(AdaptyPaywallProduct? product) async {
    if (product == null) return null;
    AdaptyProfile? result = await Adapty()
        .makePurchase(
          product: product,
        )
        .timeout(
          const Duration(seconds: 30),
        );
    return result;
  }

I have these functions, if you call them in order, purchase always on timeout TimeoutException after 0:00:30.000000: Future not completed I have to reset applications to make a purchase

x401om commented 1 year ago

@UlasKasim-dusyeri Thanks for the wait and the report! We are indeed experiencing this problem and it looks like it is an iOS bug. We are now closely investigating the situation, I will keep you informed.

x401om commented 1 year ago

Hey, @UlasKasim-dusyeri! This bug was caused by strange behaviour of SKPaymentQueue. We have changed the logic of restorePurchases for the iOS SDK and now this fix is in Flutter SDK also. Feel free to reopen the issue in case of problems.