Does refreshReceipt ask for AppStore credentials?

孤街浪徒 提交于 2020-01-16 08:02:10

问题


I have been testing In App Purchases for iOS in a sample app. I need to figure out if I can call refreshReceipt API immediately at the launch to check user's eligibility for some trial period subscriptions etc.

I have called refreshReceipt in AppDelegate's application:didFinishLaunching:options method but it asks me for AppStore credentials, basically the Sandbox user's password. I was not expecting this behaviour as read from Apple docs. Is it something that is happening because of the sandbox environment or does it happen in Production environment as well.

Also, does Restore Purchase trigger the AppStore login alert. Apple docs say it does, but recently I saw one of the music apps on my phone did not ask for credentials when I opted the option. It may be that they are not calling the StoreKit's restorePurchase API, rather using their own mechanism.


回答1:


You'll receive the login prompt whenever the receipt isn't present on the device. In sandbox, there are no installation receipts so you're always seeing the popup. You should also notice that the receipt still doesn't exist after it's refreshed in sandbox unless you made a purchase.

If the user is logged in to their iTunes account, a receipt should always be there in production.

For restores, I would assume it follows this same logic (asks for prompt if receipt isn't present) but this contradicts what Apple says.



来源:https://stackoverflow.com/questions/56558018/does-refreshreceipt-ask-for-appstore-credentials

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!