Restoring purchases gives me a [Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store"]

Hi Everyone,


We recently implemented in app purchases on our app and I am experiencing some strange behavior. Using a sandbox user credentials I am able to purchase a non consumable product perfectly fine. However every time I try to restore that purchase, I get the following error :

Error Domain=SKErrorDomain Code=0 "Cannot connect to iTunes Store" UserInfo=0x170464b40 {NSLocalizedDescription=Cannot connect to iTunes Store}.


Here is how I initiate a restore :


    @IBAction func restorepurchasesnow(sender: AnyObject) {
        if transactionInProgress {
            return
        }       
        SKPaymentQueue.defaultQueue().addTransactionObserver(self)
        SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
        restorepurchase.setTitle(NSLocalizedString("settings.inprogress", comment: "Transaction in progress"), forState: UIControlState.Normal)
        self.transactionInProgress = true
        println("Trying to restore purchases")
    
    }


Has anyone experienced the same thing ? Does anyone know how to fix it ?


Thank you !

Replies

I am struggling with this exact same issue! I'm using Objective-C and auto-renewing In App Subscriptions, but I'm having the exact same issue when I run restoreCompletedTransactions. I have been using JCSubscriptionManager and it was working yesterday; I swapped it out today for MKStoreKit, and now when I hit Restore it gives me the exact same "Cannot connect to iTunes Store" error.


The weird thing is that both JCSubscriptionManager and MKStoreKit's restore function simply calls [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]. There's no difference between the two in this respect, so changing it shouldn't have changed anything.


I've tried calling [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] directly myself and get the same problem.


I have tried restarting my phone, I've deleted and reinstalled the app, I've created new sandbox users and used those accounts. I'm at my wits end on this.


I have no problem purchasing, just restoring!


Any help would be tremendously appreciated.


I'm almost wondering if there is a problem with restoration in Apple's sandbox environment at this time. EDIT: I have submitted a bug report to Apple, just in case.

#22671211

I am also pretty sure that it was working fine yesterday.

I have tried everything you mentionned above and I cleared the settings on my phone as well without any luck. I definitely think the problem is on apple's end.

Would you mind updating this thread if you hear back on the bug report you posted ?

It's working today! With the same build. Must have been an apple issue.

Apple finally contacted me back on my bug report...7 months later...to inform me that they could not reproduce the bug. I let them know it is working now. Just updating as promised!