Step 1. Create a test account online.
Step 2: Log out of the current account in Settings.app> App Store.
Step 3: DO NOT sign up for a test account.
Step 4: Build and run the application on the device, signed with a development profile (not ad-hoc).
Step 5: Make your purchase. This will give the UIAlertView through which you log in to the test account.
If you log into your test account using any other mechanism, and especially if you add credit card information, this test account will be constantly violated. I recommend trying your steps above with a new test account. To make them easier to remember, I usually suffix my test account names with a number and increment it every time.
source share