Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always get "Restore Failed" #140

Open
6 tasks
chaocharleswang opened this issue Feb 21, 2017 · 4 comments
Open
6 tasks

Always get "Restore Failed" #140

chaocharleswang opened this issue Feb 21, 2017 · 4 comments
Labels
area: purchase flows purchase processes, efficiency and failures type: bug

Comments

@chaocharleswang
Copy link

Platform

  • [x ] iOS
  • macOS
  • tvOS

In app purchase type

  • Consumable
  • [ x] Non-consumable
  • Auto-Renewable Subscription
  • Non-Renewing Subscription

Environment

  • Sandbox
  • [x ] Production

Version

0.8.0

I always get "Restore Failed" message when restoring purchases.

SKError(_nsError: Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo={NSLocalizedDescription=Cannot connect to iTunes Store})

When I purchase again, I need "Sign In to iTunes Store".

Is it possible to pop up "Sign In to iTunes Store" dialog when restoring purchases?

Thanks!

@bizz84
Copy link
Owner

bizz84 commented Feb 21, 2017

@chaocharleswang I have just observed this as well when using a production Apple ID on one of my apps.

Some debugging revealed that the PaymentQueueController.restoreCompletedTransactionsFailedWithError is called when attempting to restore purchases, and this causes it to fail.

Following that, SwiftyStoreKit reports an unhandled transaction on the payment queue, but by the time this is received the callback has already returned. This then caught on the next app launch when completeTransactions() is called.

I have however tried the SwiftyStoreKit demo app with a sandbox user:

  • Sign out of Apple ID on iTunes & App Stores under Settings
  • Install and launch SwiftyStoreKit Demo app
  • Tap on Restore Purchases
  • System popup asks to use existing Apple ID or create a new one.
  • Choose existing Apple ID and enter credentials for a sandbox user ID
  • Restore purchases flow continues and is completed successfully.

Some guesses:

  • This may be an issue with iTunes not processing IAPs temporarily (unlikely)
  • Using production IDs with non-App Store builds does not work as intended and this may work ok with a live app from the App store.

I'll keep investigating this. Also please let me know if you have updates.

@androidcn
Copy link

i have same problem...
how to fix?

@tbergeron
Copy link

@bizz84 Thanks for your research! This is interesting. It's happening to a lot of my (potential) customers, in various countries. I doubt this is iTunes being so sloppy as it happens so often. I opened an issue with more information #175 if I find anything I'll keep you folks posted!

@bizz84
Copy link
Owner

bizz84 commented May 18, 2017

I can't reproduce this. As a side note, I recently discovered that Apple recommends using the receipt to find purchased products, rather than restoring purchases directly.

See my answer here #207.

Maybe you could try to implement this with receipt verification instead?

@bizz84 bizz84 added type: bug area: purchase flows purchase processes, efficiency and failures labels May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: purchase flows purchase processes, efficiency and failures type: bug
Projects
None yet
Development

No branches or pull requests

4 participants