RevenueCat / purchases-flutter

Flutter plugin for in-app purchases and subscriptions. Supports iOS, macOS and Android.
https://www.revenuecat.com/
MIT License
602 stars 167 forks source link

Entitlement returning empty product.title #212

Closed dpedrinha closed 3 years ago

dpedrinha commented 3 years ago

Describe the bug Although I'm getting my IAP product just fine, it's coming with an empty string for the title and description on iOS.

Same behavior on the Weather sample app.

App Store Connect IAP status == approved.

Was working fine until yesterday before I update flutter.

Flutter doctor:

Doctor summary (to see all details, run flutter doctor -v): [✓] Flutter (Channel master, 2.3.0-17.0.pre.625, on macOS 11.4 20F71 darwin-x64, locale pt-BR) [✗] Android toolchain - develop for Android devices ✗ Unable to locate Android SDK. Install Android Studio from: https://developer.android.com/studio/index.html On first launch it will assist you in installing the Android SDK components. (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions). If the Android SDK has been installed to a custom location, please use flutter config --android-sdk to update to that location.

[✓] Xcode - develop for iOS and macOS [✗] Chrome - develop for the web (Cannot find Chrome executable at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome) ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable. [!] Android Studio (not installed) [✓] VS Code (version 1.57.1) [✓] Connected device (1 available)

! Doctor found issues in 3 categories.

ghost commented 3 years ago

Hello! It doesn't seem like we have quite enough information to send this to a human yet to help out. We would love if you could provide more details about your issue by following the template without modifying any of the pre-filled text. If you're looking for support, head over to our Help Center to get in touch with our team directly.

dpedrinha commented 3 years ago

Hello! It doesn't seem like we have quite enough information to send this to a human yet to help out. We would love if you could provide more details about your issue by following the template without modifying any of the pre-filled text. If you're looking for support, head over to our Help Center to get in touch with our team directly.

What am I supposed to do with this? Create another issue? Won't you complain of repeated threads? If I were you I wouldn't like it, so I'm not doing it. I'll place the answers, this bot is asking, here.

Let's see: 1.2. How widespread is the issue. Percentage of devices affected. 100%. I have only one device to test, Apple doesn't have simulators running iOS 14.6 and it's not possible to test real IAP on simulators. That's why I didn't answer this question.

1.2. Debug logs that reproduce the issue There are no debug logs related to this problem. The debug logs show exactly what I described, entitlements with empty product titles and descriptions. That's why I didn't answer this question.

1.3. Steps to reproduce, with a description of expected vs. actual behavior Run the app and don't get any product.title or description. I already explained it. That's why I didn't answer this question.

1.4. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.) Really? If I give a clear description of the problem, there will be no "other information". That's why I didn't answer this question.

Add any other context about the problem here. Again, if I give a clear description of the problem, there will be no "other context". That's why I didn't answer this question.

I hope @issue-check is now pleased.

rkotzy commented 3 years ago

The debug logs would confirm if the SKProduct was retrieved correctly from Apple or not:

What am I supposed to do with this? Create another issue? Won't you complain of repeated threads? If I were you I wouldn't like it, so I'm not doing it. I'll place the answers, this bot is asking, here.

The goal of Github issues is to track and update SDK bugs in public, so anyone facing the issue can follow along. The bot exists to try and get enough relevant information from developers for our engineers to quickly reproduce the issue and triage the bug. There are a lot of problems that come up during app development that aren't bugs in the SDK. For troubleshooting and general help we recommend our Help Center where you can search of questions and submit support tickets.

dpedrinha commented 3 years ago

@rkotzy I'm not using storekit (as I said before) and I have only one product and one language. SKProduct was fetched fine, but without title and description. It was working before and now it's not anymore as explained in #201.

I get all you are saying but it's also meant to be discussed. Maybe it's not a bug in the SDK, maybe it's my fault, but it can also be situation that others can face and even a problem with iOS. Either way, it's a way for others to find solutions to use the RC product. The only way to know is discussing, not closing all threads.

You asked me to test the Magic Weather example and I did. And I got the same problem. So it clears out my side of the coding. Excluding itunes connect settings which I've revised over and over and all statuses are Approved, it leaves us either a problem on Apple's or Revenue Cat's side. Considering that both iOS and Flutter had updates since the last RC plugin update, I'd be digging deeper into it if I were you. Or even if it's a problem on apple's side, alter all, it affects your product.

I've shown my code, I've tried the example, and everything should be working, but it's not. So tell me, what can it be? There's clearly a very weird problem involving your product. Tell me, how closing the threads help anybody in anyway? Who said the other matter is gone? I just can't test it because something else is preventing me from troubleshooting it.

But now back to what matters, can you confirm the example is working with the latest flutter and plugin versions? THAT would help a lot.

aboedo commented 3 years ago

Hi @dpedrinha,

can you confirm the example is working with the latest flutter and plugin versions?

I just tried this on the example app, including the following snippet, pretty much copy/pasted from your thread in the previous issue (but adding prints):

    print("here come the offerings");
    Offerings _offerings;
    Offerings offerings;
    if (_offerings != null)
      offerings = _offerings;
    else {
      try {
        offerings = await Purchases.getOfferings();
        print("current offering's title:");
        print(offerings.current.monthly.product.title);
      } on PlatformException catch (e) {
        print(e.toString());
      }
    }

And it did work correctly. Here's the output (I'm adding a bit of formatting manually for readability, but it's still not great, I apologize):

2021-07-06 14:28:56.801129-0300 Runner[466:21015] flutter: current offering's title:
2021-07-06 14:28:56.801416-0300 Runner[466:21015] flutter: Monthly $4.99, 1-week free
2021-07-06 14:28:56.802723-0300 Runner[466:21015] flutter: Offerings{
{current: 
    Offering{identifier: main, serverDescription: the standard set of packages, availablePackages: [
        Package{identifier: $rc_annual, packageType: PackageType.annual, product: Product{identifier: com.revenuecat.annual_39.99.2_week_intro, description: Annual $39.99, 2-weeks free, title: Annual $39.99, 2-weeks free, price: 39.9900016784668, priceString: $39.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P2W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 2, introPriceCycles: 1}}, offeringIdentifier: main}, 

        Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: com.revenuecat.monthly_4.99.1_week_intro, description: Monthly $4.99, 1-week free, title: Monthly $4.99, 1-week free, price: 4.989999771118164, priceString: $4.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P1W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 1, introPriceCycles: 1}}, offeringIdentifier: main}, 

        Package{identifier: $rc_lifetime, packageType: PackageType.lifetime, product: Product{identifier: com.revenuecat.lifetime.199.99, description: Lifetime Cats, title: Lifetime Cats, price: 199.99000549316406, priceString: $199.99, currencyCode: USD, introductoryPrice: null}, offeringIdentifier: main}, 

        Package{identifier: 500 Coins, packageType: PackageType.custom, product: Product{identifier: com.revenuecat.500coins.1.99, description: 500 coins for cat food, title: 500 coins for cat food, price: 1.9900000095367432, priceString: $1.99, currencyCode: USD, introductoryPrice: null}, offeringIdentifier: main}],

        lifetime: 
        Package{identifier: $rc_lifetime, packageType: PackageType.lifetime, product: Product{identifier: com.revenuecat.lifetime.199.99, description: Lifetime Cats, title: Lifetime Cats, price: 199.99000549316406, priceString: $199.99, currencyCode: USD, introductoryPrice: null}, offeringIdentifier: main},

        annual: Package{identifier: $rc_annual, packageType: PackageType.annual, product: Product{identifier: com.revenuecat.annual_39.99.2_week_intro, description: Annual $39.99, 2-weeks free, title: Annual $39.99, 2-weeks free, price: 39.9900016784668, priceString: $39.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P2W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 2, introPriceCycles: 1}}, offeringIdentifier: main}, sixMonth: null, threeMonth: null, twoMonth: null,

        monthly: Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: com.revenuecat.monthly_4.99.1_week_intro, description: Monthly $4.99, 1-week free, title: Monthly $4.99, 1-week free, price: 4.989999771118164, priceString: $4.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P1W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 1, introPriceCycles: 1}}, offeringIdentifier: main}, weekly: null
}, 
all: {
default: 
    Offering{identifier: default, serverDescription: Default Offering, availablePackages: [
        Package{identifier: $rc_annual, packageType: PackageType.annual, product: Product{identifier: rc_3999_1y_1w0, description: Unlimited access, title: Unlimited access, price: 39.9900016784668, priceString: $39.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P1W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 1, introPriceCycles: 1}}, offeringIdentifier: default}], lifetime: null, annual: 
        Package{identifier: $rc_annual, packageType: PackageType.annual, product: Product{identifier: rc_3999_1y_1w0, description: Unlimited access, title: Unlimited access, price: 39.9900016784668, priceString: $39.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P1W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 1, introPriceCycles: 1}}, offeringIdentifier: default}, sixMonth: null, threeMonth: null, twoMonth: null, monthly: null, weekly: null}, 
    Offering{identifier: main, serverDescription: the standard set of packages, availablePackages: [
        main: Package{identifier: $rc_annual, packageType: PackageType.annual, product: Product{identifier: com.revenuecat.annual_39.99.2_week_intro, description: Annual $39.99, 2-weeks free, title: Annual $39.99, 2-weeks free, price: 39.9900016784668, priceString: $39.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P2W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 2, introPriceCycles: 1}}, offeringIdentifier: main}, 
        Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: com.revenuecat.monthly_4.99.1_week_intro, description: Monthly $4.99, 1-week free, title: Monthly $4.99, 1-week free, price: 4.989999771118164, priceString: $4.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P1W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 1, introPriceCycles: 1}}, offeringIdentifier: main}, 
        Package{identifier: $rc_lifetime, packageType: PackageType.lifetime, product: Product{identifier: com.revenuecat.lifetime.199.99, description: Lifetime Cats, title: Lifetime Cats, price: 199.99000549316406, priceString: $199.99, currencyCode: USD, introductoryPrice: null}, offeringIdentifier: main}, 
        Package{identifier: 500 Coins, packageType: PackageType.custom, product: Product{identifier: com.revenuecat.500coins.1.99, description: 500 coins for cat food, title: 500 coins for cat food, price: 1.9900000095367432, priceString: $1.99, currencyCode: USD, introductoryPrice: null}, offeringIdentifier: main}], 
        lifetime: Package{identifier: $rc_lifetime, packageType: PackageType.lifetime, product: Product{identifier: com.revenuecat.lifetime.199.99, description: Lifetime Cats, title: Lifetime Cats, price: 199.99000549316406, priceString: $199.99, currencyCode: USD, introductoryPrice: null}, offeringIdentifier: main}, annual: 
        Package{identifier: $rc_annual, packageType: PackageType.annual, product: Product{identifier: com.revenuecat.annual_39.99.2_week_intro, description: Annual $39.99, 2-weeks free, title: Annual $39.99, 2-weeks free, price: 39.9900016784668, priceString: $39.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P2W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 2, introPriceCycles: 1}}, offeringIdentifier: main}, sixMonth: null, threeMonth: null, twoMonth: null, monthly: 
        Package{identifier: $rc_monthly, packageType: PackageType.monthly, product: Product{identifier: com.revenuecat.monthly_4.99.1_week_intro, description: Monthly $4.99, 1-week free, title: Monthly $4.99, 1-week free, price: 4.989999771118164, priceString: $4.99, currencyCode: USD, introductoryPrice: IntroductoryPrice{introPrice: 0.0, introPriceString: $0.00, introPricePeriod: P1W, introPricePeriodUnit: WEEK, introPricePeriodNumberOfUnits: 1, introPriceCycles: 1}}, offeringIdentifier: main}, 
        weekly: null
}}

I also tried fetching the products through getProducts directly, just in case.

I think there might be something wrong with the title of that particular SKProduct. Perhaps creating a new one would help? I realize that it's terribly annoying to create a new one in App Store Connect, but I'm not sure how else to figure this out, if you've double-checked your App Store Connect settings - either there's something else there that's not configured correctly, or it's corrupted on Apple's side. The SDK doesn't actually store any of this data, it just fetches it from Apple and displays it.

So I think creating a new SKProduct might be worth a shot, and might solve the issue. I'm sorry you're going through so many headaches when getting set up. Please understand that we're trying our best to figure this out, but configuration issues can be really hard to pin down.

dpedrinha commented 3 years ago

Thank you for the input @aboedo.

Can you please confirm the Flutter channel and version and the plugin version?

The weirdest thing is that the iOS native purchase confirmation screen comes with a title.

I tried changing the localization text to see if somehow "unlocked" whatever is stuck in there but with no result.

So I think creating a new SKProduct might be worth a shot, and might solve the issue. I'm sorry you're going through so many headaches when getting set up. Please understand that we're trying our best to figure this out, but configuration issues can be really hard to pin down.

If I confirm the problem by using exactly the same versions you are using, I guess that'd be the only explanation. Wouldn't be the first time. I've a history of unexplainable things regarding Apple. For instance, I don't know how this app got approved. One day they send me a message denying it and the other day it was Ready for sale without any input from me (and my title was gone).

Please confirm your versions so I can try it before "extreme measures".

Another option would be something corrupted on my mac. Either way, I'll format it and create a new product if this last attempt doesn't work.

aboedo commented 3 years ago

sure thing! from flutter doctor:

[✓] Flutter (Channel stable, 2.0.4, on macOS 11.4 20F71 darwin-x64, locale
    en-US)

This is with Xcode Version 12.5.1 (12E507), running plugin version 3.3.1.

The weirdest thing is that the iOS native purchase confirmation screen comes with a title.

That's surprising! I'd have thought that the title would be empty for both or neither. 🤔

I honestly don't imagine that it would have any effect, but are there any special characters or anything odd in the title itself?

dpedrinha commented 3 years ago

@aboedo and @rkotzy I found the problem.

Well, I mean, I fixed it, but I have no idea what the problem was.

I tested @aboedo's flutter version (2.0.4) and it worked (WOHOO). I then thought the problem was on the latest flutter version (2.4.0 master channel), but then I upgraded back to v2.4.0, et voilà, to my surprise, title and description are still there.

That's... weird... and new...

I wonder how something in the framwork sdk got corrupted to a point of damaging just that little peace of data. I didn't know I could have this kind of problems on a macbook, after all, it's "the safest operating system in the world" (irony, I hate everything Apple).

There is one more thing that I did: I created a new localization for my product on the app store, English, which I'm not using on this particular app. But I don't know if it was it because the titles and description are still on the right language (not English). Maybe it "unstuck" something there on app store connect. I will never know.

Either way I blame Apple for this. It was either a problem on the mac or on app store connect. But hey! Who knows? Maybe somebody else will stumble upon this problem one day. I hope it helps.

Anyways, you can close the thread now. Oh wait, it was already closed.

I'll get back to testing #201. Now on the Magic Weather app.

I hope this was the cause of the other problem too...

aboedo commented 3 years ago

@dpedrinha thanks for the update! I'm glad you figured this out 🎉🎉🎉

If I had to bet I'd say it was the language thing, the product might have gotten corrupted or somehow ended up with a messed up localization, and adding the English one fixed it.

Have a great day!

taquitos commented 3 years ago

Added https://github.com/RevenueCat/purchases-flutter/issues/214

github-actions[bot] commented 3 years ago

This issue has been automatically locked due to no recent activity after it was closed. Please open a new issue for related reports.