Can In App Purchases be tested in the IOS 8 (XCode

2019-03-14 18:20发布

问题:

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?

回答1:

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.



回答2:

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