I have a solution in the SKPaymentQueue class. I use the canMakePayments method to check in-app purchase restrictions.
From the Apple documentation:
Link to the SKPaymentQueue class: canMakePayments
βThe iPhone may be restricted by access to the Apple App Store, for example, parents may restrict the ability of their children to purchase additional content. Your application must confirm that the user is allowed to allow payments before the payment is added to the queue. Your application may also want to change its behavior or appearance if the user is not allowed to authorize payments. "
Code example:
if ([SKPaymentQueue canMakePayments]) { SKPayment *payment = [SKPayment paymentWithProductIdentifier:identifier]; [[SKPaymentQueue defaultQueue] addPayment:payment]; } else { NSLog(@"In-App Purchases are not allowed"); }
source share