SKPaymentQueue addTransactionObserver asks for a password for the App Store when it starts after an in-app purchase

My application uses in-app purchases, and most of my users can buy as best as possible, without any problems. For these people, my application downloads content after a successful purchase, and they are happy.

However, for a growing number of my users, when they complete a successful purchase in the application, they are asked about their password in the App Store every time the application starts after that. I believe this happens when called:

[[SKPaymentQueue defaultQueue] addTransactionObserver:observer]; 

which I invoke at startup in accordance with step 6 of the Apple in-app purchase guide:

I assume that for some reason, Apple's purchase servers in the application do not register a successful transaction, even if I call

 [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 

when the transaction is completed and my content has been successfully uploaded.

2 questions:

  • Does anyone else see this?

  • Does anyone have a suggested fix?

BOUNTY EDIT :

This is a transaction that was made using another Apple-ID. This is why it cannot be completed unless you enter the correct credentials in the dialog box. The question should be:

  • How can I prevent such dead transactions (the transaction is not completed yet, the user does not have a network, but for now the App-ID is changing)?
  • How can you trim SkPaymentQueue ?
+54
iphone app-store itunes in-app-purchase
Feb 14 '11 at 3:45
source share
14 answers

I had the same problem. Make sure you call

 [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 

for all three transaction states: SKPaymentTransactionStatePurchased, SKPaymentTransactionStateRestored, SKPaymentTransactionStateFailed.

+31
Jun 01 2018-12-12T00:
source share

I had the same problem as the login prompt when calling:

 [[SKPaymentQueue defaultQueue] addTransactionObserver:observer]; 

It also appeared from time to time, even when I did not use my application (on the main screen or in other applications), which was really annoying. Looking around, it seems that there are so many suggested answers to this question, but I finally found a solution from a combination of what I put together.

Note. Prior to step 1, I removed the test sandbox in iTunes Connect. I am not sure if this will affect the decision.

To solve the problem, this is what I did:

  • Launch the application from Xcode.
  • Wait for the prompt to appear. Enter the password for the desired account and tap OK.
  • Click the "Home" button on your device.
  • Kill the application from Xcode.
  • Remove the application from the device.
  • Sign out of iTunes and the App Store in the Settings app.
  • Turn off the device and turn it on again.
  • Buy something from the App Store. When it prompts you to log in using your Apple ID account. (I assume that you should be able to just log in with a production account in iTunes and the App Store in the Settings app, but I did it).
  • Return to Xcode and run the application again. (This should be a new installation, since you uninstalled the application earlier.)
  • Wait for the login request to appear.
  • Click Cancel. In the Log In dialog box, click Continue and log in to check for downloads. [Environment: Sandbox] "should appear. This was a key difference from the previous ones. I never had this dialog when I clicked" Cancel "when he asked me to enter a password.
  • Click Continue.
  • Enter the password for the account.

What is it. From that moment, the login prompt ceased to appear when I started the application, and also stopped walking at random moments.

Hope this helps!

+5
Aug 23 '15 at 7:01
source share

I suspect this is the correct behavior. When you set the SKPaymentQueue delegate, try to check if there are any transactions to complete. There may not be any completed transactions, but the fact of verification requires access to iTunes. And I think you can do nothing about it.

This usually makes some sense, but it is rather annoying for users who have set up a password request for each transaction (for example, to protect some children). So the only way to deal with it is to set the delegate explicitly when you are going to request iTunes. For example, you can add some button, for example "Restore my purchases". Not very pretty, but definitely less annoying.

+3
Apr 09 2018-12-12T00:
source share

There is a problem called the "infinite loop". This was a big problem in the early days of using renewable energy sources, when for about a week the servers did not limit the extension to 5. A device that receives a transaction and does not call finishTransaction will receive this transaction, which is delivered to the device approximately once a week, until this particular user The test will not log into the system and will not call the finishTransaction function. If you switch to airplane mode, you can clear these transactions for another week, but they will return.

+3
Apr 01 '14 at 4:18
source share

DO NOT DELETE ANSWER HERE. It was this issue on Stackoverflow that misled me and ruined me for a long time.

I put this here because there are many very bad answers that provide INCORRECT information on how to solve the problem.

NO NO:

  • Delete the user of the test program. This does not solve the problem, and you will have to contact your Apple administrator to resolve it manually.
  • If you delete the user of the sandbox test program when you are subsequently prompted to log in as that user and complete the transaction, you cannot, therefore, this name is Endless Loop . In addition, you cannot add the remote test user again; the developer portal says that the user ID is already in use.
  • Uninstall the application or reinstall iOS or any other such nonsense. It does not affect, does not solve the problem and spends a lot of time.

DO:

  • Finish call for ALL transactions.
  • If someone is interrupted for any reason, just fill it in the next time you start the application. The application will be resubmitted a notification about the payment queue until you call it completion:

[[SKPaymentQueue defaultQueue] finishTransaction: transaction];

This, complete all transactions! In addition, you will be sent to hell of an infinite loop of a sign in requests each time your application is launched on this device.

+2
Jun 12 '16 at 11:12
source share

I have the same problem when testing IAP.
I tested with 3 test accounts, the application will request a password for both accounts. even if I did not touch the buy / restore button or addTransactionObserver.
I think this is due to the fact that some previous transaction ended incorrectly,
but [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; can't help at all.
so here is what i am doing to solve this problem:

  • enter the password for each account no matter how many times the application store I ask - I enter 6 times for 3 accounts - until it never asks again.
  • go to the setting and display the Apple ID.
  • exit the application usually - do not terminate it in xcode. then run the process in the task list.
  • uninstall the application from the device (just uninstalling the application will not work, it will still ask for a password)
  • reboot the device.
  • Launch the application again from Xcode / in your case, reinstall the application from the application store.

inspired by the expected consistency when using iTunes testing user

+1
Mar 26 '14 at 20:59
source share

I resolved this by removing the test iTunes Connect user account associated with this issue. The application really asked me to log in again, but then it disappeared (I also uninstalled the application, restarted the iPhone and logged in as a normal user without a sandbox, made a real recovery in another application without a sandbox, and then launched the application)

+1
May 12 '14 at 16:42
source share

It seems to be an insoluble problem :) I will send a request with support from Apple ...

0
Oct 27 '11 at 10:08
source share

Removing and reinstalling the application will delete all old transactions associated with another itunes account. If you still see transactions sent to the notification queue, then you probably had some kind of branch in your logic that did not trigger endTransaction.

You need to call finishTransaction for all transactions that are sent to paymentQueue: updatedTransactions: even those with SKPaymentTransactionStateFailed.

0
May 7 '12 at 2:18
source share

application purchase errors fixed in iOS 5.1.1 update http://support.apple.com/kb/DL1521

0
May 08 '12 at 21:30
source share

Check the following as it was in my viewDidLoad method. My application was rejected when the apple wanted me to switch from non-expendable to consumables, however I left the following line in the viewDidLoad method: (I thought that password request was a problem when replacing a tester user with a regular user and a test user )

 [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]; 

After removing the request to stop the password.

And I left: [[SKPaymentQueue defaultQueue] addTransactionObserver:self]; and the application is now approved just fine.

0
Aug 16 '12 at 23:25
source share

You know, I solved this problem by making changes to my updated transactions. I did not add [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; for all situations.

0
Jan 20 '14 at 3:35
source share

Here's how I can consistently reproduce and solve this problem:

iOS 8.4, application build development.

1) Use a test (sandbox) Apple account.

2) Restore purchased transactions.

 [[SKPaymentQueue defaultQueue] restoreCompletedTransactions] 

3) Close the application immediately.

4) Exit from the test account (via settings)

5) Run the application

Now every time I run the application, it gives out a login form. It doesn't matter if you enter the password or not. It doesn’t matter if I make purchases or restore purchases. It doesn’t matter if I uninstall and reinstall the application. Each time I launch the application, the login to iTune is displayed.

Fixed: Hard reboot of the device.

That is what I do not know. Will this happen in a production environment (published application and actual Apple login)? I hope no.

0
Aug 07 '15 at 5:05
source share

If anyone sees this and uses GoogleMobileAds.framework, you may also need to call

 [GADMobileAds disableAutomatedInAppPurchaseReporting]; 

in -application:didFinishLaunchingWithOptions:

0
Apr 14 '16 at 16:03
source share



All Articles