Kebechet / Maui.RevenueCat.InAppBilling

MIT License
13 stars 6 forks source link

Calling login always results in failure #2

Closed CameronVetter closed 1 year ago

CameronVetter commented 1 year ago

I'm attempting to execute this line of code:

var customer = await _revenueCatBilling.Login(_authService.CurrentUser.UniqueId);

This always returns null and returns the following error on Android:

[0:] Maui.RevenueCat.InAppBilling.Services.RevenueCatBilling: Error: Login failed.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Maui.RevenueCat.InAppBilling.Services.RevenueCatBilling.<Login>d__19.MoveNext() in D:\OneDrive\Programming\Csharp\Maui.RevenueCat.InAppBilling\Maui.RevenueCat.InAppBilling\Platforms\Android\RevenueCatBillingAndroid.cs:line 235
[DOTNET] fail: Maui.RevenueCat.InAppBilling.Services.RevenueCatBilling[0]
[DOTNET]       Login failed.
[DOTNET]       System.NullReferenceException: Object reference not set to an instance of an object.
[DOTNET]          at Maui.RevenueCat.InAppBilling.Services.RevenueCatBilling.<Login>d__19.MoveNext() in D:\OneDrive\Programming\Csharp\Maui.RevenueCat.InAppBilling\Maui.RevenueCat.InAppBilling\Platforms\Android\RevenueCatBillingAndroid.cs:line 235

I've verified that _revenueCatBilling.IsInitialized() is true, am I missing something obvious that is needed to login successfully?

Kebechet commented 1 year ago

1) Does it work correctly on iOS ? 2) Do other methods work ? e.g. LoadOfferings 3) What value do you put there ? Arent there some forbidden characters ? or isnt it too long/short ?

Because we use login function on Android as well, and for us it works okay. We have GUID as UniqueId

Kebechet commented 1 year ago

Hmm, that error happens here: https://github.com/Kebechet/Maui.RevenueCat.InAppBilling/blob/main/Maui.RevenueCat.InAppBilling/Platforms/Android/RevenueCatBillingAndroid.cs#L235-L243

So probably something from customer info is nullable and we try to parse it anyway

@CameronVetter I cant reproduce it but probably you will. The easiest way for you to find this problem is to:

CameronVetter commented 1 year ago
  1. Does it work correctly on iOS ?
  2. Do other methods work ? e.g. LoadOfferings
  3. What value do you put there ? Arent there some forbidden characters ? or isnt it too long/short ?

Because we use login function on Android as well, and for us it works okay. We have GUID as UniqueId

  1. On IOS I do get a CustomerInfoDto object back, so it appears to be Android only.
  2. Yes On Andoird Loadofferings works as expected, on IOS I'm getting an error but it appears to be telling me my config isn't right (just tried it for the first time for question 1)
  3. I'm sending it the Unique ID from Azure B2C which is a GUID, seems happy with this on iOS
Kebechet commented 1 year ago

v1.0.5 is released https://www.nuget.org/packages/Kebechet.Maui.RevenueCat.InAppBilling/1.0.5

Thanks for the PR