0

I use Revenucat to manage the subscriptions. A free trial period is offered and to determine the eligibility of the user, I use the following code provided by revenuecat and I test the code by using the SandBox (Test Flight returns the same issue.)

Purchases.shared.getOfferings { offerings, error in
  if let product = offerings?.current?.availablePackages.first?.storeProduct {
    Purchases.shared.checkTrialOrIntroDiscountEligibility(product: product) { eligibility in
      if eligibility == .eligible {
        self.freeTrialElgibility = true
      } else {
       self.freeTrialElgibility = false
      }
    }
  }
}

But it returns the following error message :

‼️ App running on sandbox without a receipt file. Unable to determine into eligibility unless you've purchased before and there is a receipt available.

In addition to that, how it's possible to detect if the user is using the free trial subscription? I tried this block :

 Purchases.shared.getCustomerInfo { (customerInfo, error) in
                self.isSubcriptionActive =  customerInfo?.entitlements.all["All Access"]?.isActive == true
            self.isTrialPeriod = customerInfo?.entitlements.all["All Access"]?.periodType.rawValue == 0
         
          
        }

But isTrialPeriod remains to false. I think I didn't understand the meaning of "periodType".

If someone could help me, it would be great.

Many thanks in advance.

Jean-François

If I tried to restore the subscription, it worked, The free trial period eligibility is detected.

But this method is not recommended (sign-in prompt appears), I used syncPurchases instead as recommended by RevenueCat, same error message.

I read on Stackoverflow that a method was to count the number of receipts. If the number of receipts is 0, We can considered that the eligibility is true. How to get this number of receipts with RevenueCat?

jnpdx
  • 45,847
  • 6
  • 64
  • 94
Jeff 974
  • 69
  • 1
  • 4

0 Answers0