(iOS + StoreKit)我可以检测到我在沙箱中的时间吗? [英] (iOS + StoreKit) Can I detect when I'm in the sandbox?

查看:161
本文介绍了(iOS + StoreKit)我可以检测到我在沙箱中的时间吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用内购买工作正常,我正在进行服务器验证路线。服务器需要知道我是否在沙盒中,所以现在我只是发送一个& sandbox = 1参数。当然,当应用程序的完整版本出来时,我不会发送此参数。

I've got in-app purchases working just fine, and I'm going the server validation route. The server needs to know whether I'm in the sandbox or not, so for now I'm just sending it a "&sandbox=1" parameter. Of course when the full version of the app is out I won't be sending this parameter.

我宁愿在我的应用程序中没有这个硬编码,因为将来的测试变得困难,在向Apple提交构建版本之前记住更改是一件大事。

I'd rather not have this hardcoded in my app, as that will make testing difficult in the future, and it's one more (big) thing to remember to change before submitting builds to Apple.

有没有办法我可以问StoreKit如果我我在沙盒中,然后我可以确定是否需要将此参数发送到我的服务器?或者,还有其他最佳实践来处理服务器验证吗?

Is there a way I can ask StoreKit if I am in the sandbox so I can then determine whether or not I need to send this parameter to my server? Alternatively, is there any other best practice for handling server validation?

考虑到这一点,我应该让服务器先检查实时系统,然后再检查沙箱吗?如果在实时和沙箱系统之间隔离苹果ID,那么它会不会造成任何伤害吗?

Thinking about this more, should I just have the server always check the live system first, then the sandbox? If apple IDs are segregated between the live and sandbox systems then it wouldn't do any harm would it?

谢谢。

推荐答案

经过一番挖掘后,我从Apple的技术说明TN2259

After a bit of digging I found this from Apple's Technical Note TN2259:


如何验证收据(iOS)?

How do I verify my receipt (iOS)?

请务必先使用生产网址验证收据;如果您收到21007状态代码,请继续使用沙箱URL进行验证。遵循此方法可确保您在沙盒中测试或查看应用程序时无需在URL之间切换,或者在App Store中进行实时更新。

Always verify your receipt first with the production URL; proceed to verify with the sandbox URL if you receive a 21007 status code. Following this approach ensures that you do not have to switch between URLs while your application is being tested or reviewed in the sandbox or is live in the App Store.

所以看起来我应该完全破解& sandbox 参数并且就这样做。我真的不得不去挖掘这个答案,所以我在这里发帖,希望别人可以碰到它!

So it looks like I should axe the &sandbox parameter completely and just do that. I really had to dig for this answer so I'm posting it here in hopes that someone else runs across it!

这篇关于(iOS + StoreKit)我可以检测到我在沙箱中的时间吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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