Kebechet/Maui.RevenueCat.InAppBilling

Calling login always results in failure

Closed this issue · 4 comments

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] �[41m�[30mfail�[39m�[22m�[49m: 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?

  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

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:

  • remove InAppBilling nuget from your app
  • download our whole repo
  • from InAppBilling repo add .csproj to your solution
  • from your main app add that project to dependencies: Dependencies->RightClick->Add project reference and in projects choose the InAppBilling
  • then put breakpoint on line 235
  • and then start your project with debugger and inspect what values are null there
  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