I tried adding a function for Promo-Codes so I can give some users something for free.
I created a Promo-Code inside App Store Connect and this is my function to open the PromoCodeView
:
@objc func promoCodeButtonTapped() {
let paymentQueue = SKPaymentQueue.default()
if #available(iOS 14.0, *) {
paymentQueue.presentCodeRedemptionSheet()
}
}
The view is presented properly. However I can't do anything there. I can type in a code or cancel but I can not confirm or anything. What am I missing here?? I am running it on the live-version btw. I know I can not test it in development.
The App is live! If you want to test it yourself:
https://apps.apple.com/de/app/wishlists-einfach-w%C3%BCnschen/id1503912334
Generated Promo Code for the In-App Purchase:
HE9T64F74JHT
If one can make it work, he can get Premium of my app for free with this code :D (Profile -> Premium Membership -> Promo Code )
You have a slight misunderstanding of how promo codes work, and to be honest, it is a little confusing on Apple's part.
presentCodeRedemptionSheet
is only used to redeem promo codes associated with an auto-renewing subscription. Promo codes for other IAP types are redeemed through the App Store app. Since your IAP is a non-consumable this applies to your app.
I was able to redeem the code you supplied using the following process:
You can remove the "Promo code" button from your UI; It isn't applicable in your case.