i get a timeout error (-1001) when trying to make an in app purchase. this began happening suddenly after in-app-purchase had been working fine for a while. what happens now is that i see my inventory, complete with prices retreived from apple, but after i attempt a purchase and the following code is executed:
SKPayment *payment = [SKPayment
paymentWithProductIdentifier: product.productIdentifier];
[[SKPaymentQueue defaultQueue] addPayment: payment];
all i get is a timeout error.
i created a test project with nothing but the storefront supplied by a reliable third party (urban airship) which i'd been using successfully with some alterations in my app. i got the same in app purchase timeout error, which strongly suggests some kind of issue on apple's end (it seems that either my device or my app id have gotten blackballed somehow -- perhaps after i'd uninstalled the app a bunch of times to reset its state -- at least with the sandbox servers). so now the question is what to do about it. any help would be appreciated.
problem solved: it was after all an apple issue. apparently the new app store agreement had gummed up the works. i had to install something via the app store on the device, after which the in-app-purchase was a-okay again. thanks all for your help.
Related
I'm adding In-App-Purchase (IAP) to my App. I've followed all the guidelines regarding setting up a test user for the Sandbox and logging OUT of the real App Store account. While testing I was buying and cancelling. At one point the device re-sync'd with iTunes and apparently restored and re-connected me to the production store. I didn't notice this until an attempt to buy didn't produce the normal login dialog, which I cancelled. Since that point I've been getting SKPaymentTransactionStateFailed in:
-(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
And the error SKError in the Error object indicates: SKErrorPaymentCancelled which was true but also happened days ago.
I get this regardless of if the device is connected to the internet or not (even if wifi is off). It appears to have cached the fact that the transaction was cancelled someplace and is stuck. Nothing clears it that I have tried including:
Creating a new test user and deleting the old one.
Deleting the App and re-installing.
Deleting the test products that generate this.
Clean and re-build the project including build folder.
Resetting the device and all the other voodoo.
Any ideas what is going on here? How does one clear what is cached? It doesn't appear that I am required to acknowledge that fact to the store in anyway. Furthermore, what I find really odd is that I get these SKPaymentTransaction notifications at launch, EVEN if the device is offline?!
SOLUTION: Well the App Store was caching something on the device and the only solution was to re-install iOS 9 and to NOT restore from a previous backup. Cleaning the project and the build folder did not help, neither did deleting the App from the device or any of the places that iTunes stores it and then re-installing the production App.
I have a Mac OSX app in production, available for download via the Mac App Store. The app uses in-app-purchase to buy a single non-consumable item (unlocking the Pro version of the app). The purchase mechanism works fine on all my machines (both in testing and also production, I've even spent my own money testing the app on the store!) Many customers successfully purchase the Pro version.
However, several customers have also reported problems when trying to purchase, and looking at the available anonymous usage data suggest a significant percentage of customers may be having trouble. In almost all cases, it seems that
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
is called with transaction.transactionState being set to SKPaymentTransactionStateFailed with the corresponding transaction.error set to Domain=SKErrorDomain Code=0 "Unknown Error." NSLocalizedDescription=Unknown Error.
How should one go about debugging this? What are the cases that can lead to this error? It would be great to have a list so that one would know what could be done.
For example, on my machine, trying to buy and then, when prompted for the Apple ID password, if one clicks Cancel this leads to the above error. What are some other reasons? (Since several users have reported problems, and presumably they have not simply decided to cancel their purchase...)
UPDATE: Using the software 'Little Snitch 3' I observed that my app (production app installed from the Mac App Store) contacted the server sandbox.itunes.apple.com (via storeinappd or something similar), in addition to a bunch of other apple servers. Should a production app ever attempt to connect to the sandbox? Is this an indication that something is wrong?
Thanks for any help! I'm new here, but I'll try to be responsive in providing more info (if needed) and responding to comments and answers!
I have an app with working In App purchases, it was approved by Apple and it is now in Appstore. A few days ago I submitted a new version of the app with one new consumable purchase, implemented as others were.
I'm using MKStoreKit and this method to buy a feature:
// ... showing loading window
[[MKStoreManager sharedManager] buyFeature:feature
onComplete:^(NSString* purchasedFeature,NSData* purchasedReceipt, NSArray* availableDownloads) {
// ... some handler and close loading
onCancelled:^ {
// ... another handler and close loading
}];
In Sandbox mode this method ends either in onComplete block, either onCancelled block, getting all correct identifiers (with new purchase too). However, due to Apple's reviewer's answer my loading is never closed. Also, they say that new purchase is now in Developer Action Needed Status, but can not edit it now, and I can not delete it (even if I check Cleared For Sale for NO).
May the problem be in the new purchase product or is it something else? I'm totally confused...
What can I do? Anyone encountered such a problem? I can not reproduce the error in Sandbox since it is working fine, so is there any way I can get the same result as in the Apple Review Team?
that was a strange bug on Apple servers caused by this new In App. I don't know why, but I could not delete it. Also, it had broken all In Apps but only while Apple Review testing, as I've said, all was fine in Sandbox mode. The solution was to write to Apple's support, and after a while they fixed it, I deleted this In App and everything started to work as is should.
I released a new version of an app yesterday which added in app purchases. We did testing with a test account in sandboxed mode and everything worked correctly, however once we download the app from the app store the SKProductsRequestDelegate method:
(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
returns invalid product id's instead of valid ones. I'm baffled because I've had these types of problems before but only when trying to get them to work in debug mode, never after the app has been released from the app store. I've double checked everything on the list here http://troybrant.net/blog/2010/01/invalid-product-ids/ and none of those are the problem.
Here's another thread which is exactly my problem but no solution here: iOS In App Purchase - "Invalid Product ID" in release, NOT development version
I also encounter this problem and after 22 hours the problem be fixed automated. So I think this is the app store's problem that apple need some time to add your iap ID in their server.
It turns out in app purchases are magic. At around 8 pm we noticed that things started working normally. We had previously filed a request for help from Apple but never received a response so I'm not sure if that's what kicked off the fix or if it was just one of those things we needed to wait on.
I am also suffering with this issue and I went to Apple Developer Forum to get the solution. The problem is might be with Review team's device or environment.
Here is the link of full thread: https://devforums.apple.com/thread/233371
Apple states that all apps using in-app purchases have to put this
[[SKPaymentQueue defaultQueue] addTransactionObserver:self.observer];
at the beginning of the app to handle for any successful sale that for some reason the device has not received the confirmation to release the content.
I am trying to test this, trying to call the phone when it is about to finish the transaction, quitting the application or stopping Xcode before the transaction finish, but for some reason, even when I quit Xcode, iOS appears to continue handle the transaction and the app never receives the SKPaymentTransactionStateRestored. The app always receive the SKPaymentTransactionStatePurchased and appears to be fail proof (perhaps the new iOS 4 handles that better than the 3.2 when StoreKit was released).
My question is: do you guys know any situation I can create here to generate the failure and receive the SKPaymentTransactionStateRestored when the app starts? I need to test if the app is working well for this kind of situation.
thanks
SKPaymentTransactionStateRestored is only for when you call restoreCompletedTransactions (so a user can restore their in-app purchases on a new device). If you quit the app without calling finishTransaction:, the transaction stays in the queue and you will get SKPaymentTransactionStatePurchased again.