开发者

How to test In App purchase again and again and again...?

My in app purchase project working perfectly now, but I need to test purchasing and when once purchase is s开发者_StackOverflowuccessfully done it cannot be undone? How can I test in app purchasing and upgrading my app to full version when it can be done just one time?


  1. Delete the app from your device
  2. Run "Clean" from the Product menu in XCode
  3. On your device, go to "Settings", "Store", "Apple ID", and Sign Out
  4. Start your app again, since you're not signed in to any account, the previous in-app purchase will not be recognized and you'll be able to buy it/download it again with the same test user account


None of the answers is really correct. Even if the you remove the cached purchase from your testing device, the product is marked as bought in Apple's server, associated to your test Apple ID. So the testing will not exactly reproduce the expected behavior. This is very important for testing the restore products function use cases, for example.

As far as I know, the real answer to this question is: You can't without creating a new test account, but that's not a really big deal, you can even use an invented email address (no need to validate it), and you can delete the account after using it.


If you delete your app and reinstall it, you can repurchase products. It follows the same code flow and nearly exactly the same user experience (there is a dialog letting you know that you can repurchase for free the second time). Also you can create more test users in iTunes Connect to be sure that you are doing completely clean testing.

I've spent several weeks deleting and reinstalling my app many times per day to ensure that my storekit implementation works just like I want it too.


All you have to do is delete your app from the device. This will wipe out any NSUserDefaults where you may have stored in-app purchase details.

Once you run your app again, make the purchase one more time, and Store Kit will tell you this:

"You've already purchased this. Tap OK to download it again for free"

Once you tap OK, you go through the same sequence of events you did when you made your first in-app purchase, so you can test again and again.


Use unit tests on your app, with false data, until you're satisfied.

(create test code - for each module you use)

I think I'll need more description of your process to have a better answer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜