iOS 7本地(在设备上)收据验证和应用内购买检查 [英] iOS 7 Local (on device) Receipt Validation and In-App Purchases Check

查看:402
本文介绍了iOS 7本地(在设备上)收据验证和应用内购买检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在Apple的Receipt Validation Programming Guide的帮助下使用OpenSSL和asn1c编译器在设备上本地实现了收据验证。我的应用程序仅支持iOS 7及更高版本。

I have implemented receipt validation locally on the device using OpenSSL and the asn1c compiler with help from Apple's Receipt Validation Programming Guide. My app only supports iOS 7 and up.

根据Apple推荐,我打电话给 [[NSBundle mainBundle] appStoreReceiptURL] 获取应用商店收据。当应用程序在显示任何UI之前首次启动时,我也会执行此操作。首次启动呼叫是必需的,因为如果第一次尝试不在那里,Apple建议刷新收据。由于此次通话( SKReceiptRefreshRequest ),该应用程序会要求用户输入其iTunes登录信息。

As recommended by Apple I call, [[NSBundle mainBundle] appStoreReceiptURL] to get the app store receipt. I also do this when the app is 'first' launched before displaying any UI. This first launch call is needed as Apple recommends refreshing the receipt if its not there on first try. As a result of this call (SKReceiptRefreshRequest) the app asks the user to enter their iTunes log in information.

现在的问题是Apple一直拒绝该应用程序说我正在调用他们的生产服务器而不是沙箱服务器。但根据我对收据验证编程指南的理解,只有在使用第二种验证方法并通过您自己的安全服务器向Apple发送数据时才有效。然而,我在本地做所有事情,并且对于如何区分生产环境和沙盒环境非常困惑,以便我的应用程序可以通过审核。

Now the problem is Apple keeps rejecting the app saying I am making calls to their production servers instead of the sandbox servers. But that according to what I understand from the Receipt Validation Programming Guide is only valid if you use the second approach of validation and send data to Apple via your own secure server. I am however doing everything locally and am very confused about how to differentiate between the production and sandbox environments so that my app may pass review.

任何指针或建议都会非常很有帮助。

Any pointers or suggestions would be very helpful.

推荐答案

好吧所以这里有什么对我有用,Apple经过多轮审核上诉后批准了该应用程序 - 提交时间差不多一个月。

Alright so here is what worked for me, Apple approved the app last night after multiple rounds of review appeals and re-submissions spanning almost a month.

在应用启动时不要尝试刷新收据,也不要阻止用户界面。我所做的是在发现收据之前没有显示任何UI,所以当在启动时提示输入iTunes密码时,取消将显示应用程序的限制版本,输入正确的密码将尝试下载新的收据并采取行动根据是否找到一个。

Do NOT try and refresh the receipt when the app launches and do not block the UI. What I was doing was not showing any UI on launch until a receipt was found, so when prompted for the iTunes password on launch pressing cancel would show the limited version of the app, entering a correct password would try and download a new receipt and act according to whether one was found.

因此,如果您发现收据没问题,那么在发布时如果没有,请不要尝试刷新它。

So on launch if you find a receipt thats fine, if not do not try and refresh it.

但是当用户按下Restore Purchases选项时,请刷新它。

DO however refresh it when the user presses the Restore Purchases option.

希望这会有所帮助。

这篇关于iOS 7本地(在设备上)收据验证和应用内购买检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆