gpt4 book ai didi

iphone - 检查 InApp 购买是否受到限制

转载 作者:塔克拉玛干 更新时间:2023-11-02 09:20:34 24 4
gpt4 key购买 nike

在 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com