In-App Purchase frequently asks for App Store login credentials

Hello Community,


I have an App that uses In-App Purchases. Basically it works fine, but since some iOS 9 Release the App requests the App Store login credentials continuously and about every hour.

It does not help to just enter the credentials, because after some time (about 1 hour) it asks again.


I have already reviewed the change logs but could not find any changes related to that. Because of the fact that nothing has changed in the App itself, it must be caused by something "external".


In the Release Notes of iOS 9 I found following Known Issue. Maybe it is related to this:

„Users might be prompted twice for credentials on the first In-App Purchase.“


I have also checked this site („Download iOS 9.0 - 9.3.2 Information“):

https://support.apple.com/kb/DL1842?locale=de_AT&viewlocale=en_US


Could it has something to do with the new two-factor authentication which came with iOS 9?


Would it help to just rebuild the App with the latest SDK and to upload it to the App Store again?



Any ideas?

Does your app attempt to automatically restore purchases? A subtle behavior change between iOS releases might have produced the effect you're seeing.

There are two very different reasons for getting this request for a log-in 1) you ask for it and 2) you asked for it. The first can only be a result of the app executing a restoreCompletedTransactions or a SKReceiptRefreshRequest and StoreKit is therefore asking the user to verify who they are before giving them what they are asking for. The second comes from an earlier transaction request that generated a transaction and a call to updatedTransactions but was not completed with a finishTransaction. In that case there is a transaction somewhere within your device waiting to push itself to updatedTransactions as soon as you log in with the correct username/password. Number 2 can haunt a device and a user particularly if the actual username that requested the original un-finished transaction is no longer active.

Thanks bob133 and PBK!


When the App starts I am sending a SKReceiptRefreshRequest.


SKRequest *request = [[SKReceiptRefreshRequest alloc] init];
request.delegate = self;
[request start];


If this succeeds, then...


- (void)requestDidFinish:(SKRequest *)request

...gets called and I am extracting the data from the receipt with following code.


NSURL *receiptUrl = [[NSBundle mainBundle] appStoreReceiptURL];
NSData *receiptData = [NSData dataWithContentsOfURL:receiptUrl];


After this I am executing some custom code, which sends the receiptData to my server for further validation against the Apple App Store.


I have now added the finishTransaction call for the case SKPaymentTransactionStateRestored because I missed that, but I doubt that this solves the problem, because updatedTransactions does not seem to be called in this special problem case.

I have added some logging to locate the problem maybe. A big problem is that it happens only in rare cases, if I have connected the iPhone to Xcode Debugger.

You will only get a call to updatedTransactions if you have added a transaction observer and log in with username of the user responsible for the missing finishTransaction.

In AppDelegate the method didFinishLaunchingWithOptions: contains

[[SKPaymentQueue defaultQueue] addTransactionObserver:self];


The AppDelegate also contains the paymentQueue:updatedTransactions: delegate method which handles the different Transaction States and calls finishTransaction if applicable.


Unfortunately everything looks fine to me ;-)

>....and log in with username of the user responsible for the missing finishTransaction.

In-App Purchase frequently asks for App Store login credentials
 
 
Q