Права CustomerInfo возвращаются пустыми - RevenueCatIOS

Программируем под IOS
Ответить
Anonymous
 Права CustomerInfo возвращаются пустыми - RevenueCat

Сообщение Anonymous »

Я переношу свой iAP со SwiftyStoreKit на RevenueCat.
Следуя документации здесь: 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 🎉") // THIS IS NOT READ

// 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
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»