Man_Parashar
Man_Parashar

Reputation: 113

presentCodeRedemptionSheet() is not working

I am creating offer codes with auto-renewable In-app purchases in swift. But when i use presentCodeRedemptionSheet(), it does not show any redemption page to redeem offer code. I am using below code, but nothing is happening on tapping the button.

let paymentQueue = SKPaymentQueue.default()
if #available(iOS 14.0, *) {
    DispatchQueue.main.async {
        paymentQueue.presentCodeRedemptionSheet()
    }
}

Upvotes: 2

Views: 3010

Answers (2)

David Green
David Green

Reputation: 902

I had the same issue. For me the problem was that the device was not signed in to the app store. To fix it, I tapped on "restore purchases" in the app which caused iOS to prompt me for an Apple ID. Once signed in, presentCodeRedemptionSheet() causes the expected UI to display.

Upvotes: 0

jfgrang
jfgrang

Reputation: 1178

Are you trying on the simulator?

This command only works on a real device not in the simulator.

Upvotes: 4

Related Questions