It’s important to check if app purchases are enabled in the app to block the user interface, the RayWenderlich blog says:
Apple demands that you handle this situation gracefully; this will not lead to a rejection of the application.
When you turn off the in-app purchase, restrictions SKPaymentQueue.canMakePayments()should return false, but it always returns trueno matter what. I tried with two different projects, including this one from RayWenderlich.
I tested this only with iOS 9.
How do I know if in-app purchases are disabled with parental restrictions?
Update
Someone asked to share my code. I do not think this is necessary, the code is obvious and has no errors. I can also reproduce these issues with the Ray project.
func addTextFromProduct(p: SKProduct) {
if let title = p.localizedTitle as String? {
self.navigationBar.topItem?.title = title
}
if let description = p.localizedDescription as String? {
if dailyLimit {
self.informationLabel.text? = "\(waitingTime)\(description)"
} else {
self.informationLabel.text? = "\(description)"
}
if SKPaymentQueue.canMakePayments() {
unblockButtons()
}
} else {
self.informationLabel.text? = "\(waitingTime)\(description)\n\nIn-App Purchase is unavailable at this moment."
blockButtons()
}
if SKPaymentQueue.canMakePayments() {
self.priceFormatter.locale = p.priceLocale
let localPrice: String! = self.priceFormatter.stringFromNumber(p.price)
let label = "\(localPrice)"
self.buyButton.setTitle(label, forState: UIControlState.Normal)
} else {
blockButtons()
buyButton.setTitle("Not Available", forState: UIControlState.Disabled)
}
}
source
share