I have successfully implemented auto-renewable subscriptions (In App Purchase) in my app using StoreKit. I am still in development mode so I am using sandbox user for testing. Once I subscribe to the monthly subscription using the sandbox environment I can have access to the "premium content". I use UserDefaults to indicate that a user has purchased a product. I have not implemented receipt validation.
My problem is that the subscription never expires since I can have access to the premium content anytime I want, way after the expiration of the subscription i.e. max. 30 minutes given that renewals happen at an accelerated rate in testing mode (6 * 5minutes)
My question: are auto renewable subscriptions expiring if we store the product purchased in userDefaults ? should I have to use receipt validation to have the auto renewable subscription expired?
private func productPurchaseCompleted(identifier: ProductID?) {
guard let identifier = identifier else { return }
purchasedProductIDs.insert(identifier)
UserDefaults.standard.set(true, forKey: identifier)
productPurchaseCompletionHandler?(true, identifier)
clearHandler()
}