iPhone:以编程方式检查应用内购买状态
如您所知,可以从“设置”->“常规”->“限制”打开和关闭应用内购买。现在我想知道,在我们实际进行任何付款之前,有什么方法可以以编程方式检查应用内购买的状态。
As you know that, In-App Purchase can be turned on and off from Settings->General->Restrictions. Now i am wondering, is there any way to check the status of of In-App Purchase programmatically, before we actually make any payment.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我在 SKPaymentQueue 类中找到了解决方案。我正在使用“canMakePayments”方法来检查应用内购买的限制。
来自 Apple 文档:
SKPaymentQueue 类参考:canMakePayments< /a>
示例代码:
I've got the solution in SKPaymentQueue class. I am using the "canMakePayments" method to check the restrictions on In-App Purchases.
From Apple Documentation:
SKPaymentQueue Class Reference: canMakePayments
Sample Code:
大多数用户设置可以通过读取存储在
/User/Library/Preferences/ 中的属性列表来访问。
但由于沙箱限制,您可能无法访问其中某些设置。所以你必须通过代码来尝试一下。Most of the user settings can be accessed by reading the property lists stored at
/User/Library/Preferences/.
But there are chances you might not be able to access some of these due to sandbox restriction. So you will have to try this out via code.