title: Restore Purchase : Non-Consumable
body: <p>I have completed a small app where I have a non-consumable purchase option. It is on the App Store.</p>
  
  <p>The purchase of the product runs OK. It's my Restore Purchase function that seems to do nothing.</p>
  
  <p>I have added this code for the Restore Purchase <code>@IBAction</code>:</p>
  
  <pre><code>@IBAction func restorePurchases(sender: AnyObject) { 
      SKPaymentQueue.defaultQueue().addTransactionObserver(self)
      SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
  }
  </code></pre>
  
  <p>But nothing happens when I hit the restore purchase button.</p>
  
  <p>I think I have to add a function that checks if the restore was successful or not. Am planning to amend code to the following:</p>
  
  <pre><code>@IBAction func restorePurchases(sender: AnyObject) { 
      SKPaymentQueue.defaultQueue().addTransactionObserver(self)
      SKPaymentQueue.defaultQueue().restoreCompletedTransactions()
  }
  
  func paymentQueue(queue: SKPaymentQueue!, updatedTransactions transactions: [AnyObject]!) {
  
  for transaction:AnyObject in transactions {
      if let trans:SKPaymentTransaction = transaction as? SKPaymentTransaction{
          switch trans.transactionState {
          case .Restored:
              SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
          var alert = UIAlertView(title: "Thank You", message: "Your purchase(s) were restored.", delegate: nil, cancelButtonTitle: "OK")
          alert.show()
              break;
  
          case .Failed:
              SKPaymentQueue.defaultQueue().finishTransaction(transaction as SKPaymentTransaction)
          var alert = UIAlertView(title: "Sorry", message: "Your purchase(s) could not be restored.", delegate: nil, cancelButtonTitle: "OK")
          alert.show()
          break;
  
          default:
          break;
          }
      }
  }    
  </code></pre>
  
  <p>Will this do the trick?</p>
  
  <p>I have been through every thread in relation to effecting Restore Purchase transactions, and my research has led me to the above. So I don't think this is a duplicate of a question, but perhaps may clarify how to successfully restore purchases for others facing my similar situation.</p>