I’m migrating my iAP from SwiftyStoreKit to RevenueCat.
Following the documentation right here: https://www.revenuecat.com/docs/migrating-to-revenuecat/swiftystorekit
I’ve the Subscriptions arrange within the RevenueCat dashboard, and I’m able to fetch and show to merchandise.
When subscribing and activating the iAP for the consumer the next line shouldn’t be known as
if customerInfo?.entitlements.all["pro"]?.isActive == true || customerInfo?.entitlements.all["plus"]?.isActive == true
The subscription nonetheless goes by way of however the next returns and empty dictionary,
customerInfo?.entitlements.all
Nonetheless the next is named exhibiting the subscription
else {
print("PURCHASE WITH: (String(describing: transaction?.productIdentifier)) && (String(describing: customerInfo?.activeSubscriptions.depend))")
}
It is a Sandbox account and I’m able to retrieve a receipt.
Why does customerInfo?.entitlements.all return empty and may I take advantage of customerInfo?.activeSubscriptions as a substitute?
func subscribe() {
print("Subscribe")
print("Packages: (String(describing: providing?.availablePackages))")
print("iAP: (iAPBundle)")
impactFeedback.tapAction()
//Income Cat
if let packages = providing?.availablePackages {
for p in packages {
if p.storeProduct.productIdentifier == iAPBundle {
print("Product ID is the same as IAP")
Purchases.shared.buy(package deal: p) { (transaction, customerInfo, error, userCancelled) in
print("PURCHASED")
if userCancelled {
print("Person cancelled buy")
return
}
if let err = error {
if let error = error as? RevenueCat.ErrorCode {
print(error.errorCode)
print("ERROR: (error.errorUserInfo)")
swap error {
case .purchaseNotAllowedError:
errorDescription = "Purchases not allowed on this gadget."
showError.toggle()
case .purchaseInvalidError:
errorDescription = "Buy invalid, test fee supply."
default: break
}
}
} else if customerInfo?.entitlements.all["pro"]?.isActive == true || customerInfo?.entitlements.all["plus"]?.isActive == true {
print("Unlocked 🎉") // THIS IS NOT READ
// Replace profile
print("Buyer 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))")
}
}
}
}
}
}