Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS: How to check if In-App purchase enabled?

There are some function to check if user enable some feature. Just like location or camera roll.

But, how to check if In-App purchase enabled?

like image 339
Teexit Avatar asked Aug 22 '14 12:08

Teexit


People also ask

How do I know if my app is in-app purchases?

Find out if an app offers in-app purchases Before downloading an app, you can check if it offers in-app purchases: On the Google Play Store app, in-app purchases will be by the Price or Install button. On play.google.com/store, you'll see "Offers in-app purchases" below the name of the app.

How do you know if an app is free or paid in-App Store?

You can also identify free apps in the App Store by the download button, which is marked "Get" for all free apps (it will instead show a price if it costs money).


1 Answers

this may help on you:

Swift

if SKPaymentQueue.canMakePayments() {

    // you can, so start adding the payment to the payment queue
} else {

    // you may not, handle the rejection
}

ObjC

if ([SKPaymentQueue canMakePayments]) {

     // you can, so start adding the payment to the payment queue
} else {

     // you may not, handle the rejection
}

it is from the SKPaymentQueue class reference about canMakePayments() class method:

true if the user is allowed to authorize payment. false if they do not have permission.

and further explanation for the same method:

An iPhone can be restricted from accessing the Apple App Store. For example, parents can restrict their children’s ability to purchase additional content. Your application should confirm that the user is allowed to authorize payments before adding a payment to the queue. Your application may also want to alter its behavior or appearance when the user is not allowed to authorize payments.

like image 97
holex Avatar answered Oct 18 '22 11:10

holex