title: In-app iOS "Confirm your in app purchases" will pop out purchase list view
body: <p>I have a purchase list:</p>
  
  <pre><code>item 1 $0.99 Buy
  item 2 $1.99 Buy
  item 3 $2.99 Buy
  </code></pre>
  
  <p>When I click Buy button will get "Confirm your In-App purchases" warning window. No matter I select "Buy" or "Cancel" this warning window will disappear (this is right), but the purchase list view controller is pop out to its parent view controller. I don't know why. </p>
  
  <p>I tried many ways, get the same result --  the list view controller will pop out when I click "Confirm your In-App purchases" warning window "Cancel" or "Buy" button. just tell why. </p>
  
  <p>This is the code in list view click pay button:</p>
  
  <pre><code>- (void)buyButtonTapped:(id)sender {
  
      UIButton *buyButton = (UIButton *)sender;
      NSString *searchString ;
      if (buyButton.tag == 0) {
          searchString = PURCHASES_REMOVE_AD;
      }else if (buyButton.tag == 1){
          searchString = PURCHASES_COFFEE;
      }else if (buyButton.tag == 2){
          searchString = PURCHASES_MONEY;
      }
      for (SKProduct *product in _products) {
          if ([product.productIdentifier isEqualToString:searchString]) {
              [[RageIAPHelper sharedInstance] buyProduct:product];
              break;
          }
      }
  
  }
  </code></pre>
  
  <p>Then I come to this page:</p>
  
  <p><img src="https://i.stack.imgur.com/GRufb.png" alt="enter image description here"></p>
  
  <p>as you see in this picture, when I click "Cancel" or "Buy" button, the "Buy" view controller will disappear back to parent view controller, </p>
  
  <pre><code>- (void)failedTransaction:(SKPaymentTransaction *)transaction {
  
      NSLog(@"failedTransaction...");
      if (transaction.error.code != SKErrorPaymentCancelled)
      {
          NSLog(@"Transaction error: %@", transaction.error.localizedDescription);
      }
  
      [[SKPaymentQueue defaultQueue] finishTransaction: transaction];
  }
  </code></pre>
  
  <p>this is the code I click cancel button, don't see any problem.</p>
  
  <h2>Update</h2>
  
  <p>I finally figured it out. I create list view's parent view controller in - (void)applicationDidBecomeActive:(UIApplication *)application. Now I move the creation to - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions the problem's gone. Any one can tell me why? </p>