Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Storekit fails to restore all completed transactions

$
0
0

Hi, I use Storekit extension to manage in-app purchases for an iPhone app. This is the code I use (very similar to the example's one):

// onclick ---
function restorePurchases() {
  spinner.show();
  Storekit.restoreCompletedTransactions();
  }
 
  Storekit.addEventListener('restoredCompletedTransactions', function (evt) {
 
    if (evt.error) {
    spinner.hide();
        alert(L("GenericError",hint["GenericError"])+"-"+evt.error);
      }
      else if (evt.transactions == null || evt.transactions.length == 0) {
        spinner.hide();
        alert(L("NoPurchases",hint["NoPurchases"]));
      }
      else 
      {
      var transLen = evt.transactions.length;
      for (var i = 0; i <transLen; i++) {
        if(evt.transactions[i].identifier=="my.domain.app.all"){
            updateTableView();
        }else{
            updateTableView(evt.transactions[i].identifier);
        }
 
      }
      alert(L("RestoredNum",hint["RestoredNum"]) + evt.transactions.length);
      spinner.hide();
      }
    });
Problem is the following: anytime I click a button, the function restorePurchases() fires and I get a prompt alert with 3 buttons. The third one is the Cancel button: any time I click cancel I get the following error:

[ERROR] : Failed to restore all completed transactions: Error Domain=SKErrorDomain Code=2 "Imposible conectarse a iTunes Store" UserInfo=0xa6c8060 {NSLocalizedDescription=Imposible conectarse a iTunes Store}

How can I change my function to handle the cancel button press? Is it possible to handle it? How?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>