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

My in app purchase project working perfectly now, but I need to test purchasing and when once purchase is successfully 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?

Delete the app from your device
Run "Clean" from the Product menu in XCode
On your device, go to "Settings", "Store", "Apple ID", and Sign Out
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.

Related

MZCommerceInAppBuy.App BuyInfoDataAccessFailure_message

So I'm testing out an in-app purchase in my app. I've got the code set up properly and everything, but when I do attempt to buy or restore in the sandbox environment, I get this error:
MZCommerceInAppBuy.App BuyInfoDataAccessFailure_message
[Environment: Sandbox]
I've never seen this before, and I am finding only one Google search result from someone else who has. It never was solved. Has anybody seen this?
I figured out a solution. The problem was coming because I was adding an in-app purchase to the current live version of my app. I created a new version of my app and changed it on my target to the update version.
I also downloaded a new development provisioning profile. I'm not sure if this is necessary, but I wanted to add that I created a new one just in case.
When you add in-app purchases to an app, you must create a new app version even for testing.
Note:
Just a side note. I noticed while I received this error I also wan't receiving any in-app purchase products. You will not receive any products until you create the new version.

iOS in-app purchases skproductrequest randomly getting no products returned

I have an odd problem on my hands with in-app purchases and any insight or help would be appreciated. I have in-app purchases setup for my app and have been using them regularly during testing; however, every once in a while the SKProductRequest will return with 0 products and won't load any products until I completely remove the app from the device and re-install it. Then everything shows up again and purchases can be made.
I'm not sure what is causing this problem. It may have something to do with the test environment for in-app purchases? I know everything is configured correctly seeing as I can normally use the in-app purchases without any errors. Thanks for any help.
There may be several causes to Product Requests failing on a device. Basically, the StoreKit environment is very picky: if something in the app seems weird (like the code signature, or the embedded Provisioning Profile, or multiple app with the same profiles), it will not sent the request, or receive invalid data.
A common cause of silent failures is having multiple Provisioning Profiles installed for the same app. You can try to:
Uninstall all Provisioning Profiles from your device (in Settings),
Remove the app from the Device (to remove the embedded Provisioning Profile),
Re-install the app.
I wrote a small blog post about this issue a few months ago, you may find more detailed informations there : http://kemenaran.winosx.com/?2011/12/02/180-ios-developer-what-to-do-if-in-app-purchases-stop-working

in app purchasing submission process iphone

I am trying to submit my first iPhone app that has in-app purchasing features. Needless to say, I have been banging my head against the wall for a while. I have read through several tutorials, such as: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/ and http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/ but it seems these are outdated? For instance, I can't find where the developer is to reject the submission on iTunes connect.
Additionally, I am submitting the app the in-app purchase features included in the bundle(I don't have them stored on the server- I just want to unlock the code when the user purchases the feature). What is the best way to do this?
Thanks!
Some of the information in the linked tutorials is in fact outdated: I could create in app items in iTunes connect without having to submit (and reject) a binary first. Just be sure NOT to submit your items for review while you are testing. Also changes to the items (e.g. price tier) have been processed almost immediately and I did not had to wait 24 hours.
To unlock your feature, you may use storing and retrieving the purchased status in NSUserDefaults . But this could easily be tempered with by users with jailbreak or acces to the apps folder. Have a look at http://maniacdev.com/2011/08/open-source-ios-keychain-wrapper-for-easily-securing-user-data-for-your-app/ . This offers a simple way to store data in the keychain. Still this will not prevent someone to 'hack' your app and enable the purchased feature without actual purchase, but it's not that easy...
In-App Purchase development is definitely a pain point in iOS development - their sandboxing model for this is ridiculous.
Needless to say - the articles you're reading are still up to date. The developer reject is definitely the way to go (I think can do from within the binary details). One thing to remember is that you need to have accepted the appropriate contracts and tax schedules also - if you haven't then the store "just doesn't work".
One thing that caught me: when you submit your final version of the app - make sure you tick the in-app purchases to be included; else the in-app purchases won't be reviewed (and accepted)!
Update: Although it's pretty long... you may want to flick through this: https://itunesconnect.apple.com/docs/iTunesConnect_DeveloperGuide.pdf
Explains how to developer reject etc.

In app purchases with MKStoreKit failing: "Problem in iTunes connect configuration for product: xxx"

I'm trying to implement in app purchases in my App using MKStoreKit. I've followed all the steps and I'm getting the error:
Problem in iTunes connect configuration for product:
I've recreated the provisioning profiles, checked the product id is the same as in itunes connect, sent and rejected a binary, trying to delete everything and set it up again and nothing is working.
Any idea?
I know this is a late reply, but somehow I could not find the answer to this problem elsewhere so I decided to post my experience in hopes it might help other frustrated people with this issue.
I have recently added an In-App purchase to my Free app and I faced the same problem during the testing phase and also once it was launched on App Store.
The answer is Patience. For some odd reason, after doing everything correctly, you need to wait for around a day before your product is recognized. So once you finish your Manage In-App product ID, you will only see it working the following day - so don't delete and recreate it again - just wait.
Furthermore, after submitting your app for approval with the first In-App product, even when your app is approved and available in the App Store, the In-App might not work at first and you will feel you did something wrong. Wait another day or so, and magically, it will start to work.
It didn't work in my case cause the phone was jailbroken. After restoring it worked like a charm.
my ipad was jailbroken. it was given this "Problem in iTunes connect configuration for product: xxx" i changed my ipad with regular(no jailbrek) ipad and it's working now.

iPhone + In App purchase testing

I have implemented In App purchase in one of the existing application. I have also created SandBox account for testing it. I have run the application and tested it, its working perfect. Since, I have tested it, by buying the feature, it means I have bought that feature.
Now, there is a change in code and I want to re-test it (In App purchase thing), but since the feature is already bought I cannot test it again.
I am running and testing the application from Xcode, so I tried to delete the application from device and run / test it again by from Xcode, still no result.
If you just want to test re-downloading the content, deleting the application works.
If you want to actually re-buy it, how about creating a new additional sandbox account?