Sign-In Required Enter the password for . [Environment: Sandbox] Sign-In Required Enter the password for . [Environment: Sandbox] xcode xcode

Sign-In Required Enter the password for . [Environment: Sandbox]


I had the same issue implementing IAP in a React Native app with RevenueCat (react-native-purchases).

My solution:

  1. Inside AppDelegate.h, import StoreKit and add SKPaymentTransactionObserver to AppDelegate interface.
#import <React/RCTBridgeDelegate.h>#import <UIKit/UIKit.h>#import <StoreKit/StoreKit.h>@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, SKPaymentTransactionObserver>@property (nonatomic, strong) UIWindow *window;@end
  1. Inside AppDelegate.m, import StoreKit and in didFinishLaunchingWithOptions add the observer.
#import <StoreKit/StoreKit.h>@implementation AppDelegate- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{   [[SKPaymentQueue defaultQueue] addTransactionObserver:self];...}
  1. Again inside AppDelegate.m, add the required method updatedTransactions to meet the protocol of SKPaymentTransactionObserver.
(void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{  for(SKPaymentTransaction *transaction in transactions){    switch(transaction.transactionState){      case SKPaymentTransactionStatePurchasing:        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];        NSLog(@"Transaction state -> Purchasing");        break;      case SKPaymentTransactionStatePurchased:        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];        NSLog(@"Transaction state -> Purchased");        break;      case SKPaymentTransactionStateRestored:        NSLog(@"Transaction state -> Restored");        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];        break;      case SKPaymentTransactionStateFailed:        if(transaction.error.code == SKErrorPaymentCancelled){          NSLog(@"Transaction state -> Cancelled");        }        [[SKPaymentQueue defaultQueue] finishTransaction:transaction];        break;    }  }
  1. Run the app on your physical device that is presenting the issue, when the message comes up tap Cancel.

  2. Review in the XCode that finishTransaction was called inside of any of the switch cases. Luckily it will be called as many times as unfinished transactions there were.

After this, the annoying message shouldn't be pop up any more. In my case, there were like 15 unfinished transactions and that why the message showed up every 5 minutes... ¬¬

I commented the above code after the issue was gone because, as I said, I'm using a framework to manage IAPs.

This is just a work around but hope it works for you.


I had the same problem recently where I was constantly being asked for credentials for the sandbox account "." - It would happen whenever I opened the app in question or whenever network connectivity changed. I have no idea how it got into that state but I found that Milos had the answer.

Essentially, you need to setup a SKPaymentTransactionObserver if you don't already have one (you probably have one). Then inside paymentQueue:updatedTransactions: (docs), loop through all transactions in the queue, calling on each transaction:

Swift:

SKPaymentQueue.default().finishTransaction(transaction)

Obj-C:

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];

I had to remove existing code I had in the transaction queue loop, as it seemed to trigger the credentials dialog and meant that other transactions wouldn't finish.

Running the app with those temporary changes has fixed the problem for me afaik, so it looks like the transaction queue was just borked.


Nothing worked until reset the device on Erase All Content and Settings in the Settings app.