Last active
September 17, 2023 09:37
-
-
Save ren6/3fea1047780652ef2282a8021defc6b8 to your computer and use it in GitHub Desktop.
Refresh receipt example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private func refreshReceipt(){ | |
let request = SKReceiptRefreshRequest(receiptProperties: nil) | |
request.delegate = self | |
request.start() | |
} | |
func requestDidFinish(_ request: SKRequest) { | |
// call refresh subscriptions method again with same blocks | |
if request is SKReceiptRefreshRequest { | |
refreshSubscriptionsStatus(callback: self.successBlock ?? {}, failure: self.failureBlock ?? {_ in}) | |
} | |
} | |
func request(_ request: SKRequest, didFailWithError error: Error){ | |
if request is SKReceiptRefreshRequest { | |
self.refreshSubscriptionFailureBlock?(error) | |
self.cleanUpRefeshReceiptBlocks() | |
} | |
print("error: \(error.localizedDescription)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are you importing any native framework to the file? While trying to use the API I obtain
Cannot find 'SKReceiptRefreshRequest' in scope