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

后端 未结 14 1071
耶瑟儿~
耶瑟儿~ 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:33

    I had the same problem when testing IAP.

    I tested with 3 test account. The app kept asking for password for both accounts. Even if I didn't touch any purchase/restore button or addTransactionObserver.

    I think this is because some previous transaction has not finished correctly, but [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; can't help at all.

    So here's what I did to solve this problem:

    1. input the password for each account no matter how many times app store ask for--I input 6 times for 3 account--until it never ask again.
    2. go to the setting and sign out the apple ID.
    3. quit the app normally--don't terminate it in Xcode. then kill the process in task list.
    4. remove the app from device (simply remove the app won't work it'll still ask for password )
    5. reboot the device
    6. Run the app again from Xcode/in your case reinstall the app from app store.

    inspired by Expected sequence when using iTunes test user

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

    DO NOT DELETE THE ANSWER HERE. It was this particular Stackoverflow question that misled me and messed me up for days.

    I'm putting this here because there are a lot of really bad answers that provide WRONG information on how to resolve the problem.

    DO NOT:

    • Delete the sandbox test user. This makes it impossible to resolve the problem and you will have to contact Apple developer support to resolve manually.
    • If you delete the sandbox test user, when you are subsequently repeatedly prompted to log in as that user and complete the transaction, you can't, hence the name Endless Loop problem. Nor will you be able to add the deleted test user again; the developer portal says the user id has already been used.
    • Delete the App or re-install iOS or any other such nonsense. It has no effect, doesn't solve the problem and wastes a lot of time.

    DO:

    • Call Finish for ALL transactions.
    • If one is interrupted for some reason, simply complete on a subsequent run of the App. The app will be repeatedly sent the payment queue notice until you call finish on it:

    [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

    That's it, Finish all transactions! Else you will be sent to the hell of the Endless Loop of sign in requests every single time your App launches on that device.

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

    Deleting and re-installing the app will remove any old transactions associated with another itunes account. If you are still seeing transactions posted to the notification queue, then you likely had some branch in your logic that did not call finishTransaction.

    You need to to call finishTransaction on all transactions that are posted to paymentQueue:updatedTransactions:, even ones with SKPaymentTransactionStateFailed.

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

    You know, I resolved this problem by making a modify in my updatedTransactions. I didn't add the [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; for all situations.

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

    If anyone is seeing this and is using GoogleMobileAds.framework then you may also need to call

    [GADMobileAds disableAutomatedInAppPurchaseReporting];
    

    in -application:didFinishLaunchingWithOptions:

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

    I suspect that this is a correct behaviour. When you set a delegate SKPaymentQueue try to check if there are some transactions to finalize. There may be no not finished transactions but the fact of checking requires to login in iTunes. And I think you can do nothing with it.

    It generally has some sense, but it is pretty annoying for users who have set up asking for a password on each transaction (some child protection for instance). So the only way to struggle with it is to set delegate explicitly when you are about to request iTunes. For example you can add some button like "Restore my purchases". Not very beautiful but definitely less annoying.

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