SKPaymentQueue addTransactionObserver asking for App Store password on startup after in-app purchase

后端 未结 14 1069
耶瑟儿~
耶瑟儿~ 2020-12-01 04:46

My app is using in-app purchases, and most of my users can purchase just fine without any problems. For these folks, my app downloads the content after the purchase succeeds

相关标签:
14条回答
  • 2020-12-01 05:22

    I resolved it by deleting the iTunes Connect test user account related with this issue. App actually asked once again to sign in, but then it disappeared (I've also deleted app, restarted iPhone and logged in as a normal non-sandbox user, made a real restore in other non-sandbox app and then launched the app)

    0 讨论(0)
  • 2020-12-01 05:24

    bugs related to in app purchases fixed in the iOS update 5.1.1 http://support.apple.com/kb/DL1521

    0 讨论(0)
  • 2020-12-01 05:25

    Here's how I can consistently reproduce and resolve this issue:

    iOS 8.4, development build of the app.

    1. Use a test(sandbox) Apple Account.

    2. Restore purchased transactions.

      [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]
      
    3. Immediately close the app.

    4. Log out of test account (through settings)

    5. Launch app

    Now every time I launch the app it will pop up the "login" form. It doesn't matter if I enter the password or not. It doesn't matter if I make purchases or restore the purchases. It doesn't matter if I delete and re-install the app. Every time I launch the app, the iTune login is presented.

    Fix: Hard reboot the device.

    Here's what I don't know. Will this happen in a production environment (published app and actual apple login)? I hope not.

    0 讨论(0)
  • 2020-12-01 05:26

    I had the same problem of having the login prompt coming up at the call:

    [[SKPaymentQueue defaultQueue] addTransactionObserver:observer];
    

    It would also come up every now and then even when I wasn't using my app (on the home screen or in other apps), which was really annoying. Looking around, there seem to be so many suggested answers to this issue but I finally found a solution from a combination of what I've gathered.

    Note: Before step 1, I had removed the test sandbox account in iTunes Connect. I'm not sure if that would affect the solution.

    To solve the problem this is what I did:

    1. Run your app from Xcode.
    2. Wait for the prompt to come up. Type in the password for the account it wants and tap OK.
    3. Press the Home button on the device.
    4. Kill the app from Xcode.
    5. Delete the app from the device.
    6. Log out of iTunes & App Store in the Settings app.
    7. Turn off the device and then turn it back on.
    8. Purchase something from the App Store. When it prompts you, log in with a production Apple ID account. (I'm assuming you should be able to just log in with a production account in iTunes & App Store under the Settings app but this is how I did it).
    9. Go back to Xcode and run your app again. (This should be a new install, as you deleted the app before.)
    10. Wait for the login prompt to come up.
    11. Tap Cancel. A dialog saying "Sign In Required. Tap Continue and sign in to check for downloads. [Environment: Sandbox]" should come up. This was a key difference from before. I never had this dialog come up when I pressed Cancel when it was asking me for the password.
    12. Tap Continue.
    13. Enter the password for the account.

    That's it. From then on the login prompt stopped coming up whenever I ran my app and also stopped coming up at random times.

    Hope this helps!

    0 讨论(0)
  • 2020-12-01 05:26

    You said:

    However, for a growing number of my users, once they complete a successful in-app purchase they are being asked for their App Store password every time the app starts up after that. I believe this is happening on the call to:

    [[SKPaymentQueue defaultQueue] addTransactionObserver:observer];

    Note that the docs for add(_ observer: / addTransationObserver: state that the call may cause the user to authenticate with the App Store, so this appears to be expected behavior.

    // Observers are not retained. The transactions array will only be synchronized with the server while the queue has observers. This may require that the user authenticate.

    open func add(_ observer: SKPaymentTransactionObserver)
    open func remove(_ observer: SKPaymentTransactionObserver)

    So in addition to other answers here, it may be that you should stop calling add observer until you are ready to potentially display an App Store login prompt.

    0 讨论(0)
  • 2020-12-01 05:30

    I had the same problem.make sure that you call

    [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; 
    

    for all three states of the transactions: SKPaymentTransactionStatePurchased, SKPaymentTransactionStateRestored, SKPaymentTransactionStateFailed.

    0 讨论(0)
提交回复
热议问题