If a user has subscribed to the app but then unsubscribed, the following code still executes `subscribe()’ always for that device, even if the same AppleID is not used, with features remaining unlocked.
I have added
print("ENTITLEMENTS (customerInfo.entitlements)")
print("ACTIVE SUBS (customerInfo.activeSubscriptions)")
When a user has made an iAP, that device always returns the following. Even after erasing device.
ENTITLEMENTS <RCEntitlementInfos: self.all=[:],
self.active=[:],self.verification=VerificationResult.notRequested>ACTIVE SUBS [“com.appname.com.promonthly”]
I have also tried removing cached info with
Purchases.shared.invalidateCustomerInfoCache()
Also when opening Debug > StoreKit, not transactions are show.
I have tested via simulator and on device.
func verifyIAPReceipt() {
Purchases.shared.invalidateCustomerInfoCache()
Purchases.shared.getCustomerInfo { (customerInfo, error) in
if error == nil {
if let customerInfo = customerInfo {
if !customerInfo.entitlements.active.isEmpty {
print("ENTITLEMENTS IS EMPTY") <-- This is not executed
self.unsubscribe()
} else {
print("ENTITLEMENTS IS NOT EMPTY") <-- Executed
print("ENTITLEMENTS (customerInfo.entitlements)")
print("ACTIVE SUBS (customerInfo.activeSubscriptions)")
if customerInfo.activeSubscriptions.isEmpty == false {
print("Active Subscriptions is NOT empty") <-- Executed
for s in customerInfo.activeSubscriptions {
if s == "com.app.come.promonthly" || s == "com.app.com.proyearly" {
subscribe() <-- Executed Unlocks features
}
}
} else if customerInfo.activeSubscriptions.isEmpty == true {
print("Active Subscriptions are empty")
self.unsubscribe()
} else {
print("Active Subscription and profile is subscribed")
}
}
}
} else {
print("ERROR GETTING CUSTOMER INFO TO VERIFY RECEIPTS")
}
}
}