Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can In App Purchases be tested in the IOS 8 (Xcode 6) Simulator?

I keep finding conflicting information about whether In App Purchases can actually be tested on a simulator using Xcode 6. Some answers say 'yes', others seem to indicate there are a bug in beta versions of Xcode 6 and others flat out 'no'.

I have an app where IAP works great on the device, but in the simulator, trying to refresh the receipt fails with a very unhelpful message: Error Domain=SKErrorDomain Code=0 "The operation couldn’t be completed. (SKErrorDomain error 0.)".

My app was rejected from the app store because the tester could not test (even though it works perfectly with sandbox accounts on devices) and I am beginning to suspect that they simply tested on a simulator and were not able to proceed.
Since I had read so much about it not working on a simulator and that you had to test on a device, I didn't worry about it not working on the simulator but that may have bitten me in the backside.

Can anyone say that they have actually gotten IAP to work on IOS 8 / Xcode 6 simulators?

like image 441
N8P Avatar asked Oct 07 '14 23:10

N8P


People also ask

Can we test in-app purchase in iOS simulator?

It is impossible to make a purchase on a simulator (it is only possible to request a list of available purchases). To test purchases, you first need to set up products on App Store Connect and then use the user's sandbox environment and a real device. In this case, purchases for the developer are free.

How do I check in-app purchases on iOS?

Sign In to the App Store with Your Sandbox Apple ID In iOS and iPadOS, the sandbox account appears in Settings > App Store after the first time you use the device to attempt a purchase in a development-signed app. There's no need to sign out of the non-Sandbox Apple ID.

How do I enable in-app purchases Xcode?

In the Xcode Project navigator, select the StoreKit configuration file. Choose Editor > Enable Interrupted Purchases. Run the app in the simulator or on a device. In the app, buy an in-app purchase.


2 Answers

Most of the StoreKit sandbox does mysteriously now seem to work when using a debug-build iOS 8 target in the Xcode 6 simulator.

You can't buy an auto-renewing subscription though. You get as far as the final confirmation dialog but after that the transaction always comes back with a transactionState of SKPaymentTransactionStateFailed. Same code works on the device. I reported this on Radar, but Apple replied that StoreKit is not supported in the simulator, which is weird given that it does all seem very close to working.

like image 171
w0mbat Avatar answered Oct 13 '22 01:10

w0mbat


Actually, i have been tested in-app purchase in xcode 6 / iOS 8 simulator and it just work perfect (sandbox purchase and restore). However the other simulators (iOS 7.0.3 and 7.1) was not work for IAP.

So, the answer is yes.

Does your app contain verification methods for IAP receipt ? May be it is seemed too simple but are you sure that the verifications control not with https://sandbox.itunes.apple.com/verifyReceipt

like image 36
Binus Avatar answered Oct 13 '22 00:10

Binus