title: xcode restoreCompletedTransactions not working in sandbox with Apple hosted content
body: <p>I have a number of apps in the app store but am having a problem with my first in-app purchase.
  I'm testing with xcode 5 on an iPad with a number of test users in the sandbox.
  The in-app purchases are for additional video files hosted by Apple.</p>
  
  <p>The original purchases and video downloads go fine.  Restores of the purchases go fine, but if I delete the app and reinstall it the restore doesn't work.
  However, after a reinstall of the app, if I do a repurchase and go through the "Confirm your in-app Purchase" -> "Do you want to buy <em>_</em>_?" -> [Environment Sandbox] -> press "Buy" and get -> "You've already purchased the In-App Purchase but it hasn't been downloaded" [Environment Sandbox] -> and press "OK", then a restore of the purchase works and downloads the videos.
  My guess is that the repurchase mumbo-jumbo sets a transaction in the transactions queue but a "restoreCompletedTransactions" after a reinstall doesn't.</p>
  
  <p>In the code below, when the restore doesn't work only the "Restore transaction START" and "Restore transaction END" logs appear.
  The "restoreCompletedTransactions" doesn't seem to be finding any transactions after the app is reinstalled.</p>
  
  <p>I've searched dozens of posts (Wenderlich, Troy Brant's a full walkthrough, etc.) but it seems most restores are resetting flags of content that came with the original purchase, and not doing subsequent downloads or not worrying about users deleting the app to free up space and reinstalling.</p>
  
  <p>Expecting users to go through the "Buy" -> ""You've already purchased" route is a poor solution since some may be afraid that they are repurchasing the app.
  The only other alternative is to put all the videos in the initial bundle and then use the keychain to reset flags, but that increases the size of the download.</p>
  
  <p>Any suggestions would be welcomed.
  If anyone knows a way to add transactions to the transaction queue that would be a possible solution.</p>
  
  <p>// called when restore button pressed:</p>
  
  <pre><code>- (void) restoreTapped
  {                            
      NSLog (@"Restore transaction START");
  
      [ [SKPaymentQueue defaultQueue] restoreCompletedTransactions ];
  
      NSLog (@"Restore transaction END");
  }
  </code></pre>
  
  <p>// SKPaymentTransactionObserver Delegate method:</p>
  
  <pre><code>-(void) paymentQueueRestoreCompletedTransactionsFinished : (SKPaymentQueue *) queue
  {
      NSLog (@"received restored transactions: %i", queue.transactions.count);
  
      for (SKPaymentTransaction * transaction in queue.transactions)
      {
          [ [SKPaymentQueue defaultQueue] startDownloads : transaction.downloads ];
      }
  }
  
  
  -(void) paymentQueue : (SKPaymentQueue *) queue updatedTransactions : (NSArray *) transactions
  {
      for (SKPaymentTransaction * transaction in transactions)
      {
          switch (transaction.transactionState)
          {
              case SKPaymentTransactionStatePurchased:
  
                             [omitted]                
                   break;
  
              case SKPaymentTransactionStateRestored:
  
                       NSLog (@"Transaction State restored.");
                   break;
  
  
              case SKPaymentTransactionStateFailed:
  
                   NSLog (@"Failed transaction.");
                   [self failedTransaction : transaction];    break;
  
              default:                                       break;
          }
      }
  }
  </code></pre>