Skip to content

Instantly share code, notes, and snippets.

@ren6
Last active September 17, 2023 09:37
Show Gist options
  • Save ren6/3fea1047780652ef2282a8021defc6b8 to your computer and use it in GitHub Desktop.
Save ren6/3fea1047780652ef2282a8021defc6b8 to your computer and use it in GitHub Desktop.
Refresh receipt example
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)")
}
@damcho
Copy link

damcho commented Sep 17, 2023

Are you importing any native framework to the file? While trying to use the API I obtain
Cannot find 'SKReceiptRefreshRequest' in scope

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment