Hi guys.
Apple is asking me that if a Non-Consumable product has been purchased by a user and the user decides to delete and reinstall the App, then I must present a "Restore" instead than "Buy" button.
To check if a product has been purchased I am using NSUserDefaults, like this:
public init(productIds: Set<ProductIdentifier>) {
self.productIdentifiers = productIds
for productIdentifier in productIds {
let purchased = NSUserDefaults.standardUserDefaults().boolForKey(productIdentifier)
if purchased {
purchasedProductIdentifiers.insert(productIdentifier)
print("Previously purchased: \(productIdentifier)")
} else {
print("Not purchased: \(productIdentifier)")
}
}
super.init()
SKPaymentQueue.defaultQueue().addTransactionObserver(self)
}
But, if the user deletes the App, this information is lost.
So, Is there anyway to ask to SKPayment if a product has been purchase? I guess there is because they are asking me that. But I didnt find it.