Clarification
I know, there are tons of questions about In-App-Purchases, some of them also about dealing with real Apple IDs, but I found none with a really precise answer about the exact behaviour / errors you get, doing so.
The actual question
I have an app with IAPs, whenever I try to log in using my real Apple ID, and the app is asking for products / prices or trying to buy something, I get the following error popups.
Entering the valid password
Entering a wrong password
Already logged in when starting the app (in Settings => iTunes & App Store)
Can someone please confirm (or refute) this to be the expected behaviour?
To summarize the question(s)
Is it correct, that real Apple IDs only work in distribution signed apps (for/from the AppStore) and won't work in development signed apps?
Sandbox Accounts work in a Sandbox Environment no matter how the app was signed?
Is it correct, that real Apple IDs only work in distribution signed
apps (for/from the AppStore) and won't work in development signed
apps?
Yes. You can't use real apple IDs' in your sandbox environment.
Sandbox Accounts work in a Sandbox Environment no matter how the app
was signed?
Test users created under your account will work with the development build. It won't work with production builds which are downloaded from Appstore.
P.S. You can use a dummy email to create sandbox testers (not sure whether it still works :) )
https://developer.apple.com/library/ios/documentation/LanguagesUtilities/Conceptual/iTunesConnect_Guide/Chapters/SettingUpUserAccounts.html#//apple_ref/doc/uid/TP40011225-CH25-SW10
When I implemented iAP last month I got exactly the same experience. It all worked perfectly once the app was signed and released on AppStore so you should be safe.
The sandbox account works only in a sandbox environment and will not work if you download the app from the AppStore.
Related
We have recently updated several test devices from iOS 14.7.1 to 15.2. After that, when trying to make a test purchase inside our app, TestFlight ignores the sandbox accounts (which we add to Settings -> Apps-Store -> Sandbox account) and uses the main account that is used for purchases in the App Store.
The SandBox account works fine if you log out as the main user in the App Store - but then you can't use TestFlight to download test builds.
maybe someone has faced a similar problem and knows the solution or will tell me in which direction to look?
TestFlight ignores the sandbox accounts (which we add to Settings -> Apps-Store -> Sandbox account) and uses the main account
That is correct behavior. The sandbox account is for when you are running an Xcode build. TestFlight, on the other hand, always uses your real account, but it doesn't charge you (and the same for your beta testers).
#matt is right. The only what I can add here is that after you
logged in as sandbox user > attached device to xcode > run the build > made the purchase with sandbox user
you will be able to use that sandbox user even in next TestFlight builds.
For other testers this new approach is very uncomfortable, expecially if tester has a very complex password for their primary accounts... Apple made these things worst, for sure.
Btw, important to note that making purchases using primary account in sandbox environment (liek your testers do in TestFlight builds) will also reset the subscriptions in some time range. Not sure what exactly, probably from 5min to 1h. I didn't know it and had tons of questions, why my app doesn't recognise any previous subscription made recently. Purchase restore response also says that there is nothing to restore... Weird way of tasting, Apple...
I'm having some issues with sandbox users. According to Apple's docs
Important: If you mistakenly use a sandbox tester account to sign in to a production environment, like iTunes, on your test device instead of your test environment, the sandbox account becomes invalid and can’t be used again. If this happens, create a new sandbox tester account with a new email address.
In my case I haven't tried to login to the production environment with these accounts, but am still getting the invalidated somehow. It seems they will be good for a day or two, and for the first couple purchases and then stop working.
I'm getting back SKErrorDomain Code: 0 NSLocalizedDescription: Cannot connect to iTunes Storemost times when I try to purchase.
Most recently I even got "You are not authorized to make purchases of this InApp Purchase in Sandbox at this time. [Environment: Sandbox]"
I'm very flustered by these errors because it seems that it will work fine and then intermittently stop working. Has anyone found a way to successfully verify if an account is invalid, or found a way to get past these issues?
Each time I run into this problem, these steps typically clear it:
Make sure phone is signed out of all services (iCloud, App Store, everything)
Restart the phone.
Remove the app from phone and re-install via Xcode
When the app prompts for credentials during in-app purchase, enter sandbox credentials.
There is the very off chance that the sandbox account must accept some new terms from Apple. Log-into developer.apple.com and make sure you don't have any lingering alerts for that account.
Best of luck!
I am using In App purchase and it is working fine when i am testing it from the sandbox account. But when i tried to purchase the online subscription by making amount zero by live account. it is giving an error of
[you are not authorised to make purchase in this inApp in SandBox at this time Environment Sandbox]
i guess it was setup in sand box mode. So As i tested in sandbox and it is working fine ho can i make it live to that any one can purchase it.
I got my answer for the apple document that app installed from Xcode is always in Sandbox environment and app download from live itunes is Live. thanks a lot to all and specially for one who commented heae on post and guided me.
=>
StoreKit connects to the sandbox environment when you launch your application from Xcode, from your test device (iOS), or from the Finder (OS X). It connects to a production environment for applications that were downloaded from the App Store. You must not use your test user account to sign into the production environment. This will result in your test user account becoming invalid. Invalid test accounts cannot be used to test In-App Purchase again.
<=
Apple Document
You can not test live app with sandbox test ID as sandbox email ID has no real credit. If In App Purchase is working for sandbox ID, it will work for real IDs too.
I am implementing in app purchases for my app. I am logged out from AppStore, created some test accounts, have not verify it by e-mail.
And every time I tried to log in into sandbox app-purchase I got an transaction error. Btw product info restored correctly.
Looking deeply I notice that after any attempt to log in, my AppStore account setting in device filled with the info from this test account! So I think it tries to log in into real AppStore instead of sandbox.
What am I doing wrong? Why my test accounts tries to login into the real AppStore and how to fix it?
To know if you're in sandbox environment or not, you can have a look at the purchase popup. If you can read "[Sandbox environment]" at the bottom, then it means you're using the sandbox. Otherwise, you're using the real Appstore (But I'm pretty sure it's not the case since this is automatically chosen by the device).
Anyway, it seems that Apple Sansbox environment is experiencing some problems today.
For example, I have an app that was dealing correctly with inapp purchase yesterday. Today, only retrieving SKProducts was ok.
I recommend you to be patient until the problem is fixed by Apple.
I implemented in app purchase in my iOS app and I want to do a real test (not a sandbox) before submitting this new version to Apple
Of course, the current version of the app (in the App Store) was validated with a product
So, I archived the app using an Ad Hoc distribution profile and I generated an IPA file for Ad Hoc deployment. But when I installed the app via Testflight on my device, I discovered that the app was in sandbox environment!
Is there a way to do a "real" purchase before submitting the app to the App Store ?
You can actually test the in-app purchasing in the sandbox environment, basically you'll need to set up an test user account in your iTunesConnect.
Check the apple documentation here:
http://developer.apple.com/library/ios/#technotes/tn2259/_index.html
You'll be able to find all the information related to In-App Purchasing, including sandbox testing.
Short answer: you can't test a real purchase (aka, spend real money). It isn't possible.
Slightly longer answer: You'll automatically hit the sandbox environment unless it's an apple-signed release build. Even ad-hoc signed builds hit the sandbox.
To test a new IAP: create your IAP (it will be in "needs approval mode" until submitted with the final build and test against the sandbox - that's fine). If your purchase works against the sandbox, it should work against prod with real money as well. It would be great to do a trial run with real money, but that's just not possible until the IAP is approved and you get the production signed version of the app from the app store.
Just create a test account on iTunes Connect. Then log out from the device and run your app from Xcode.
To get access to the purchase you need apple signature, because you are connecting with the apple servers.
I assume that your app, is doesnt have that signature, so your request goes to the sandbox.