I'm trying to get In-App Purchases (IAPs) working in a macOS app using the same Swift code, sandbox testers, and iTunes Connect account that I used for my iOS app. However, I can't get it to work. I'm using macOS High Sierra 10.13.6.
Open app
Apple's IAP testing recommendations are found here:
On a development macOS device, sign out of the Mac App Store. Then build your app in Xcode and launch it from the Finder.
If the text “[Environment: Sandbox]” doesn’t appear, you’re using the production environment. Make sure you’re running a development-signed build of your app. Production-signed builds use the production environment.
I have followed these steps by signing out of the Mac App Store, and building my app – signed for development – then launching it from the Finder. This means I don't get debug logs, unfortunately.
Navigate to table of products in-app
Here's my table of products:
I can buy a product by pressing the "Free" button or the "£4.99" button.
Attempt to buy product by pressing "Free"
After a short wait, brings up this popup saying 'Sign-in required'. I sign in using one of my sandbox testers (note: I have tried five different test accounts now, all of which worked on an iOS app under the same iTunes Connect account), registered with email addresses that aren't Apple IDs:
Having selected 'Buy', a short wait after that, this next popup appears:
After selecting 'Cancel' (as recommended here), after a short wait, the next popup appears:
You are not authorized to make purchases of this InApp in Sandbox at this time.
[Environment: Sandbox]
So I'm not sure whether it logged me in or not, and I assume that my purchase has failed (my table UI doesn't update to say 'purchased'). Note that I have also tried pressing 'Change Store' here, and it still fails ultimately.
Attempt to buy product by pressing "Free" again
This time, I'm not prompted to log in; I'm instead asked immediately whether I'd like to purchase the product. I click 'Confirm'.
However, now the purchase transaction never completes:
What might I be doing wrong? Do I need to log out of anything (e.g. iCloud) in Settings > Internet Accounts too?
Seems lame, but I eventually solved this by making new Sandbox tester accounts (tip: this time, I configured them as being US-based to avoid the complication of switching stores during the payment flow).
I think the problem was that I hadn't verified the Sandbox tester accounts I'd been using. This is either because Apple's email asking me to verify/activate the Sandbox tester accounts got sorted into my junk mail and missed completely, or because their backend had been having problems when I did click the link in their emails (I experienced both of these behaviours).
Related
As usual, all the existing answers on Stackoverflow relate to iOS and nothing is out there for MacOS.
I have signed out of Mac AppStore.
When I try to attempt a IAP purchase on my app I get this error message shown:
Account Not In This Store Your account is not valid for use in the
U.S. store.
You must switch to the U.K. store before purchasing.
[Environment: Sandbox]
I have created fresh Sandbox users, but the app is not asking me to enter them. And based on the documentation of Apple I shouldn't enter them into the AppStore login or I get them wasted.
I have deleted the ~/Library/Containers/app-bundle-id, rebooted the dev machine and cleared once again the build folder. But I can't get it working.
How do I get a prompt for entering the sandbox user?
Any advice would be appreciated.
As of the release of iOS11 it has been a pain (if not impossible) testing in-app purchases. While I've found a great workaround for testing on iOS here: https://stackoverflow.com/a/46467498/4514671 I could not find anything for macOS apps.
So here is what I did that kind of does the same as with the iOS workaround:
In the App Store app Sign Out of your account (Store/Sign Out)
In iTunes Connect create a brand new Tester
Restart your computer
Open your Xcode project
Build & run
Click on your Buy button to start a purchase
Sign in with your newly created test account
When prompted to Change the store click on Cancel
Click on your Buy button to start a purchase again and the correct Buy Alert will pop up; finish the transaction by actually making the purchase
Done! Hours of frustration saved! Thanks Apple :[
My problem is testing In-App purchase in my Mac OS X application; it seems to me that the problem is related to my test account. I could test IAP on my own Mac quite well with a test user account before. But a few weeks ago while I was trying to make a purchase in sandbox a dialog box showed up saying that I should review my account information on App Store, I made a mistake by logging into the real App Store and my test account can't be used for testing now.
Here is the problem: I deleted the old test account and created a new one. Now, when I want to test the IAP the dialog box that asks if I want to purchase a product in sandbox environment and the next one that prompts for user/pass don't show up.
Using NSLog I figured out that when I enter In-App store, products are being loaded and when I click on a product to buy it, app starts buying product with product ID. If I am right, at this stage the prompt should show up saying: do you want to buy product myproduct [sandbox environment]? But this dialog box never shows up! I never experienced the same problem with the old test account.
Any suggessions?
The problem is resolved. I can now test IAP using my new test user account AFTER I updated iTunes!
I am having an application which I will be putting into the Mac App Store soon.
It will be a paid application.
It is my first app I'm transmitting, so please excuse my lack of knowledge so far.
I have some guys that helped me a lot during the development with testing and stuff.
As some kind of reward we arranged that each of them will get his version of the app for free.
The thing is that I did not think of code signing and security stuff in the beginning and now I'm having a bit of a dilemma.
I could of course give them a non-code-signed version of the app, but I do not want to have another development branch for these versions in case of future updates.
Is there any possibility for them to download the app from the App Store legally with some kind of "voucher"?
For each version of your app that you submit to the app store, you can generate 50 promo codes, which can be redeemed in iTunes
Note: promo codes expire after 30 days. I usually only generate 10 at a time, keep them safely stored in a text file with the date of generation, and delete them after sending to an individual.
To create promo codes:
1) In iTunes Connect, click "Manage your Applications"
2) Click the app
3) Click "View Details"
4) Click "Promo Codes"
For my Mac store app, I only have Release builds code signed (and sandboxed as well). Debug builds are not code signed / not sandboxed and have a "Beta" attached to the bundle ID (thus avoiding issues with non-sandbox and sandbox versions of the same bundle ID). I can then quickly give out betas to testers.
Yes, it's possible. On iTunes Connect you can create promo codes which these testers can "redeem" to get a full copy of your app on the Mac App Store.
Look for this button:
Just had an end client experience a nightmare that is mysterious.
He began the process of adding an ad hoc prototype of app.
He is saying that when he added the mobile Team Provisioning Profile that is associated with the app and the device synched, all of his apps got wiped.
I witnessed a designer go through the same process without any of this nightmare.
Any ideas what might have happened and more importantly how to avoid this from happening again?
I am praying that iTunes is smart enough to see he already purchased his apps and will just reinstall without making him pay for it again.
when syncing the device select the device->go to the apps tab in itunes->select the checkbox to sync the apps and then select only the app you want to install and then sync