Следуя документации здесь: https://www.revenuecat.com/docs/migrati ... tystorekit p>
У меня настроены подписки на панели управления RevenueCat, и я могу получать и отображать продукты.
При подписке и активации iAP для user следующая строка не вызывается
if customerInfo?.entitlements.all["pro"]?.isActive == true || customerInfo?.entitlements.all["plus"]?.isActive == true
Подписка все еще проходит, но возвращается следующий результат и пустой словарь.
customerInfo?.entitlements.all
Однако следующее называется показом подписки
else {
print("PURCHASE WITH: \(String(describing: transaction?.productIdentifier)) && \(String(describing: customerInfo?.activeSubscriptions.count))")
}
Это учетная запись песочницы, и я могу получить квитанцию.
Почему customerInfo?.entitlements.all возвращает пустое значение и следует ли мне использовать customerInfo?.activeSubscriptions вместо этого?
func subscribe() {
print("Subscribe")
print("Packages: \(String(describing: offering?.availablePackages))")
print("iAP: \(iAPBundle)")
impactFeedback.tapAction()
//Revenue Cat
if let packages = offering?.availablePackages {
for p in packages {
if p.storeProduct.productIdentifier == iAPBundle {
print("Product ID is equal to IAP")
Purchases.shared.purchase(package: p) { (transaction, customerInfo, error, userCancelled) in
print("PURCHASED")
if userCancelled {
print("User cancelled purchase")
return
}
if let err = error {
if let error = error as? RevenueCat.ErrorCode {
print(error.errorCode)
print("ERROR: \(error.errorUserInfo)")
switch error {
case .purchaseNotAllowedError:
errorDescription = "Purchases not allowed on this device."
showError.toggle()
case .purchaseInvalidError:
errorDescription = "Purchase invalid, check payment source."
default: break
}
}
} else if customerInfo?.entitlements.all["pro"]?.isActive == true || customerInfo?.entitlements.all["plus"]?.isActive == true {
print("Unlocked
// Update profile
print("Customer INFO: \(customerInfo!)")
print("Entitlements: \(customerInfo!.entitlements.all)")
if customerInfo?.entitlements.all["pro"]?.isActive == true {
subscribeToPro()
} else if customerInfo?.entitlements.all["plus"]?.isActive == true {
subscribeToPlus()
}
} else {
print("PURCHASE WITH: \(String(describing: transaction)) && \(String(describing: customerInfo))")
}
}
}
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/784 ... revenuecat
Мобильная версия