IOS: How to check if in-app purchase is enabled?

There is some function to check if the user permits any function. Just like a location or camera roll.

But how to check if the purchase is included in the application?

+5
source share
1 answer

this may help you:

if ([SKPaymentQueue canMakePayments]) { // start adding the payment to the payment queue } else { // handle the restriction } 

from SKPaymentQueue class reference to class method +canMakePayments :

YES if the user is allowed to authorize the payment. NO if they do not have permission.

and further explanation for the same method:

iPhone may be restricted by access to the Apple App Store. For example, parents may limit their children's ability to purchase additional content. Your application must confirm that the user is allowed to authorize payments before adding the payment to the queue. Your application may also want to change its behavior or appearance when the user is not allowed to authorize payments.

+4
source

Source: https://habr.com/ru/post/1200925/


All Articles