title: Restore Purchase for iAP shows alert on app startup
body: <p>I have 2 problems when I added the restore method for iAP...</p>
  
  <p>Problem 1: Everytime I open my app a iTunes alert comes up and ask if I wanna login  to the iTunes Store. This happens since I add the following restore  method:</p>
  
  <pre><code>- (IBAction)Restore:(id)sender {
      [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
      [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
  }
  </code></pre>
  
  <p>Now, even when I remove the restore method the alert keeps on coming  at startup. It seems that Apple already connects with iTunes at the  startup of the app. I wanna make this only when a user hits the purchase  or restore button. I read several things on StackOverflow that you have  to add something in your AppDelegate so that the app is not connecting  automatically but with still no luck.</p>
  
  <p>Problem 2: When testing the iAP on my phone and hit the restore button the item can  be restored, even if I didn't purchased it before. Is this normal when  testing the restore function with a test account? You should say that  Apple have to show alert that the item has never been purchased and  cannot be restored?</p>
  
  <p>Can someone please guide me step-by-step with this to make it work?</p>
  
  <p>Thanks in advance.</p>
  
  <p>The code:</p>
  
  <pre><code>- (IBAction)Restore:(id)sender {
      [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
      [[SKPaymentQueue defaultQueue] restoreCompletedTransactions];
  }
  
  -(void)paymentQueueRestoreCompletedTransactionsFinished:(SKPaymentQueue *)queue {
      [self unlockFeature];
  }
  
  #pragma mark -
  #pragma mark SKPaymentTransactionObserver
  
  -(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
  {
      for (SKPaymentTransaction *transaction in transactions)
      {
          switch (transaction.transactionState) {
              case SKPaymentTransactionStatePurchased:
                  [self unlockFeature];
                  [[SKPaymentQueue defaultQueue]
                   finishTransaction:transaction];
                  break;
  
              case SKPaymentTransactionStateFailed:
                  NSLog(@"Transaction Failed");
                  [[SKPaymentQueue defaultQueue]
                   finishTransaction:transaction];
                  break;
  
              default:
                  break;
          }
      }
  }
  </code></pre>