Can't make IAP work in sandbox (SWIFT) in simulator - swift

transactionState is always returning .Failed
any ideas? why this is happening
i have added new sandbox user in itunes connect and using its credentials in simulator to make the purchase in sandbox mode and it wont work.
it work on my physical iphone?

In-app purchase does not work in the simulator. It only works on an actual device. I'll try to find the documentation that states this.
EDIT
The closest thing I could find is under the Xcode 5 release notes:
https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/Chapters/xc5_release_notes.html#//apple_ref/doc/uid/TP40001051-CH2-SW302
StoreKit (In-App purchases) will not work in the Simulator. 13962338
Although this is for Xcode 5, I believe it's safe to assume the same holds true for Xcode 6.

Related

iOS 6 inApp issue

Anyone used iOS6 inApp purchase? My inApp was working fine on iOS5 but when i am tying to build my app in iOS6 (XCode 4.5 beta). It is showing below error while inApp purchase.
2012-10-06 15:13:49.653 failed transaction
2012-10-06 15:13:49.654 The error description is:Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo=0x9caec40 {NSLocalizedDescription=Cannot connect to iTunes Store}
I have created another test user account but problem is still same. Also, tried with restarting XCode, Mac machine, simulator, reset simulator. Please help!!
FIX : Delete all inApp ids and create new. It will fix the issue.
You cannot test In-App. purchase on simulator. If you tried to do that you will get the Confirm alert, but nothing will happen.
I had similar issue with iOS 6, I done the following procedures to fix it:
Deleted my application from IPad
Signed out from the stores
Installed my application again
Tested the In-App
It worked fine for me, make sure that the internet connection is there. If you had the problem again, just sign-out from the stores and again test In-App purchase. (when I got the error again after few In-App purchases, I done this too)

Unable to test iOS in-app purchase on devices, only simulator

When I retrieve details for in-app purchases, they are displayed fine on iPhone simulator but simulator doesn't allow me to complete a test purchase. I then try it from an iOS device (tested with 4.x and 5.x) and it doesn't display any data for the in-app purchase
I know the code is fine because the simulator works fine (until purchase) and when app is submitted and becomes approved, but this in turn makes in-app test very tricky to me...
How can I test in-app purchases on my device?
First thing to check and this is a classic is to see if you are logged in with another account that is not the test user. Check the device's settings.
Another thing is this and I had this problem 3 times before with 3 different devices: corrupted file system. The only solution that always works for me is to reset the device to factory firmware. This is done in iTunes. It will wipe your device and reinstall the firmware with the current iOS version. Prepare yourself for at least 50 minutes of pleasure and rage while you wait everything being wiped and reinstallad.
Don't forget to backup first and don't blame me if things get wrong... 😃

MKStoreKit and iOS 5

I've been using MKStoreKit to enable in-app purchases in my apps. The latest binary I submitted using this method was rejected because nothing happens when the user clicks on the purchase button when the reviewer tested it on iOS 5. Is this an iOS 5 issues, or has something else gone wonky? It works fine when I test it on iOS 4.
My iPod is too old to upgrade to iOS 5 and I've started saving up to buy a new one, but I'd like to get this app on the store before then. Also, it means that several of my other apps will be broken and I would like to fix those as well.
There is nothing special in MKStoreKit that could probably break on iOS 5. I've used it in many apps running iOS 4 and 5 without any issues. Can you test it on a real device and post what happens?

Testing In-App Purchase Works on One Device and not Another

Ok so I have an in-app purchase sandbox testing fine on an old iPod touch. Just got a new iPhone, added it to the provisioning profile I was using for this project, re-downloaded it and added it to xcode. The transaction is failing whenever I test it out on the iPhone, whereas it still works fine on the iPod touch... wtf?
Your iOS developer account can active a "test account" on only one device at a time. You have to disable the test account on the first device and re-enable it on the second. That's probably the problem — it certainly happens to me. ;-)

In app purchases iPhone simulator why disabled?

Just a quick question, do you see any reason why Apple has disabled many things on the iPhone simulator like:
testing In app purchases
testing most services of Game Center
wifi connection
How do you live with those three?
If you want to quickly debug/run your app on simulator that requires the in app purchase, do you just change some places in the source code to say the app that the purchase is done?
If you want to quicky test your application (on simulator), how it works without the Internet connection, do you turn your airport off? Do you have any ways how to check how application works when the connection is fast/slow/very slow (even on a real device)?
Regards
It seems that Apple finally allowed testing In-App purchases in the Simulator starting from iOS 5. At least, in iOS 5 Beta 6 it worked for me.
PS. I haven't found an official proof link though...
Check out this post by David Linsin.
From iTunes Connect Developers Guide:
... the Store Kit APIs are not available when testing in the iPhone simulator.
Now testing in-app purchases in simulator is enabled.
Device has UDID but simulator has no UDID.
please Follow below link . It will Clear your doubt.
http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/.
IF you need to do in-app purchases app , You must have followings.
App Id (UDID) ..(provisioning)
iTunesConnect.
Create Product identifiers from iTunesConnect.
StoreKit frameworks.
StoreKit Framework communicate between your device and App store. Not b/w iOS Simulator and AppStore.