在 iPhone 上,我可以进入“常规”->“限制”并锁定 InApp 购买。在代码方面,我如何检查用户是否已执行此操作?
最佳答案
有一个名为 SKPaymentQueue 的 StoreKit 类它有一个类方法 canMakePayments
,它可以告诉您用户是否可以进行您可以检查的购买
if ([SKPaymentQueue canMakePayments]) {
// user can make purchases
} else {
// no purchases can be made, show error
}
文档说:
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.
关于iphone - 检查 InApp 购买是否受到限制,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7730024/