I'm trying to move my paid app to in-app purchase. First of all I had to validate if app was already purchased. I implemented receipt validation with following code:
func validatercpt() {
let receiptURL = NSBundle.mainBundle().appStoreReceiptURL
if NSFileManager.defaultManager().fileExistsAtPath(receiptURL!.path!) {
print("OK")
}
else {
print("refresh")
let refreshReceiptRequest = SKReceiptRefreshRequest()
refreshReceiptRequest.delegate = self
refreshReceiptRequest.start()
}
}
the receiptURL does not exists so I try to refresh the receipt.
func requestDidFinish(request: SKRequest) {
print("req finish")
let receiptURL = NSBundle.mainBundle().appStoreReceiptURL
if NSFileManager.defaultManager().fileExistsAtPath(receiptURL!.path!) {
print("OK")
}
else {
print("not exists")
}
}
Even after refresh, the receipt still not exists.
Any suggestions?
Thanks, Max
Aucun commentaire:
Enregistrer un commentaire