title: In-App Purchase Swift
body: <p>I am using IAPHelper to implement in-app purchase, an error is occurring when I go to another view controller after pressing the purchase button. For instance, when I press the purchase button then go to another view controller the error is presented after finishing the purchase work.</p>
  
  <pre><code>class selectQuestion_ViewController:  UITableViewController, UITableViewDelegate, UITableViewDataSource{
  
  let helper = IAPHelper(productIdentifiers: NSSet(object: "sppid") as Set&lt;NSObject&gt;)
   func purchase(sender: AnyObject)
      {
          startLoading("Purchasing ..")
          self.helper.requestProductsWithCompletionHandler({ (success, products) -&gt; Void in
  
              if success {
                  self.endLoading()
                  println("wohooooo")
                  var sdad =  self.helper.productsDict["sppid"]
                  self.helper.buyProduct(sdad!)
  
              } else {
                  self.endLoading()
                  let alert = UIAlertController(title: "Error", message: "Cannot retrieve products list right now.", preferredStyle: .Alert)
                  alert.addAction(UIAlertAction(title: "OK", style: .Default, handler: nil))
                  self.presentViewController(alert, animated: true, completion: nil)
              }
  
  
          })
      }
  </code></pre>