adaptyteam / AdaptySDK-Flutter

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

[IOS] getPaywallProducts always return an empty list #69

Closed IliaKhuzhakhmetov closed 1 year ago

IliaKhuzhakhmetov commented 1 year ago

I Installed the Adapty SDK using documentation.

My environment: Flutter: 3.3.5 IOS 16.1.2

My code below (It's just fro testing):

  final adapty = Adapty();

  adapty
    ..activate()
    ..setLogLevel(kDebugMode ? AdaptyLogLevel.debug : AdaptyLogLevel.info);

  final profile = await adapty.getProfile();

  final paywall = await adapty.getPaywall(id: PaywallIds.primary);

  final paywallProducts = await adapty.getPaywallProducts(paywall: paywall);

  logger.d(
    '|Paywall: $paywall \n'
    'Paywall Products length: ${paywallProducts.length}\n\n'
    'Profile: $profile',
  );

And this is my Log:

[Adapty v2.2.0] - VERBOSE   Adapty/Adapty+AsyncHelpers.swift#64: Calling now: getPaywallProducts(paywall:fetchPolicy:_:) [FWgbxo].
[Adapty v2.2.0] - DEBUG Adapty/AdaptyProfileManager.swift#159: call getPaywallProducts with params paywall.id: primary.paywall fetchPolicy: default
[Adapty v2.2.0] - VERBOSE   Adapty/HTTPSession.Logger.swift#28: #API# GET --> /sdk/in-apps/purchase-products/ ?profile_id=bd50a127-a250-4df0-93df-c9d44d7c2109
[Adapty v2.2.0] - VERBOSE   Adapty/HTTPSession.Logger.swift#41: #API# RESPONSE <-- GET /sdk/in-apps/purchase-products/
[Adapty v2.2.0] - DEBUG Adapty/BackendProductsStorage+UserDefaults.swift#18: UserDefaults: Save products success.
[Adapty v2.2.0] - VERBOSE   Adapty/ProductsCache.swift#53: ProductsCache: saved products has eligibility == .unknown ["full.monthly", "full.annual"]
[Adapty v2.2.0] - VERBOSE   Adapty/SKProductsManager.swift#63: SKProductManager: Called SKProductsManager.startRequest retryCount:3
[Adapty v2.2.0] - VERBOSE   Adapty/Adapty+AsyncHelpers.swift#100: Completed getPaywallProducts(paywall:fetchPolicy:_:) [FWgbxo] is successful.
:┌─
: #1   <asynchronous suspension>
:├┄┄┄
: 🐛 |Paywall: (id: primary.paywall, name: Primary Paywall, abTestName: Primary Paywall, variationId: 01abc8e4-ba5b-4067-8208-c070f18cdf28, revision: 1, remoteConfigString: null, _products: [(vendorId: full.annual, promotionalOfferEligibility: false, introductoryOfferEligibility: AdaptyEligibility.unknown, promotionalOfferId: null, _version: 1670872352804), (vendorId: full.monthly, promotionalOfferEligibility: false, introductoryOfferEligibility: AdaptyEligibility.unknown, promotionalOfferId: null, _version: 1670872352804)], _version: 1670867082398)
: 🐛
: 🐛 Paywall Products length: 0
: 🐛
: 🐛 Profile: (profileId: bd50a127-a250-4df0-93df-c9d44d7c2109, customerUserId: null, customAttributes: {}, accessLevels: {}, subscriptions: {}, nonSubscriptions: {})
: └───
x401om commented 1 year ago

Hi, @IliaKhuzhakhmetov!

This seems like a pretty strange situation to me. At this point, I can assume that StoreKit is not returning the products we requested from it. Could you please answer the following questions so that I can get a better understanding of the situation?

1) Are you using real device or simulator? 2) Did you try to run our Example App? Did you get the same result? 3) Are you sure that all the products in Appstore Connect are configured correctly? Are all the fields filled in? Are there any requests from Apple to accept the Privacy Policy? 4) Could you collect all the logs, including those coming from FlutterSDK?

IliaKhuzhakhmetov commented 1 year ago

@x401om

  1. It was the real device - iPhone 13 mini
  2. No, I didn't - will try it
  3. Are you sure that all the products in Appstore Connect are configured correctly? Are all the fields filled in? - Yes, no one empty fields Are there any requests from Apple to accept the Privacy Policy? - I'm not sure because I see this caption: image
IliaKhuzhakhmetov commented 1 year ago

And i see one more caption:

image

How can I push to apple review if I can't test it?

x401om commented 1 year ago

No, you will be able to test your purchases before you send them for review. Most likely the problem is that you haven't added some parameters in the configuration of the purchases themselves. Please make sure that you have set prices and added localizations.

Generally our checklist looks like this:

  1. All the products were added to Adapty Dashboard;
  2. Bundle Id of your app matches the one from App Store;
  3. Product identifiers from the stores match with the ones you've added to the Dashboard. Identifiers should not contain Bundle Id unless they do so in store already;
  4. Please be sure, that in your Apple tax settings, the app paid status is active. Tax info should be up-to-date and certificates must be valid too;
  5. Make sure that there is a bank account attached, so the app would be eligible for monetisation;
  6. Products should be at least in "Ready To Submit" state. (Missing metadata means your forgot to add some parameters)
IliaKhuzhakhmetov commented 1 year ago

@x401om Oh Thank you! I Added Screenshots for review and now it works! I thought that it's optional for development part ;)