When I launch my Unity iOS App is keeps prompting me:
Enter the password for . [environment sandbox]
Notice there is no username and I cannot put a username. So I cannot enter a password either.
I deleted all references to the IAP (channel & purchasing folders, and disabled the IAP service), deleted the iOS build folder and rebuilt it, then compiled it.
I logged out of iTunes on the iPhone.
I still prompts me. I have attached a screenshot.

I had the same issue implementing IAP in a React Native app with RevenueCat (react-native-purchases).
My solution:
#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <StoreKit/StoreKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, SKPaymentTransactionObserver>
@property (nonatomic, strong) UIWindow *window;
@end
#import <StoreKit/StoreKit.h>
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
[[SKPaymentQueue defaultQueue] addTransactionObserver:self];
...
}
(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;
}
}
Run the app on your physical device that is presenting the issue, when the message comes up tap Cancel.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With