App asks for password every time it is launched

Hi all,

I'm testing a new app on my device and, today, I started integrating the StoreKit for In-App Purchases...


The problem is that EVERY TIME I launch the app, it asks me for my sandbox account password. Here following, you'll find some details about the problem.


1) The very first time I launched the app, everything worked as expected. No problems while completing the in-app purchase (with my sandbox user - let's call it testuser1@t.com -).

2) Stopped the app, integrated a button "Restore purchases". Unfortunately, I forgot to add "finishTransaction" at completition (not sure if this could be the problem)

3) From now on, every time I launch the app, it keeps asking me for testuser1@t.com's password.


StoreKit starts doing it's stuff in a view which is NOT the rootView, so I excluded that I'm casting something wrong programmatically...


So, what I did AFTER?

1) Deleted app from device and reinstalled (after reboot)

2) Deleted sandbox user (and created a new one - let's say testuser2@t.com -). I successfully used the NEW account in order to get a new IAP.

3) Cleared settings on my device

4) Deleted IAP from iTunes Connect


The problem is still there. Keep in mind that the password asked is for testuser1@t.com (the very first test account!)

Replies

FinishTransaction IS the problem. Without it, the APIs are trying to complete the

transaction endlessly.

Yes, I suspected it, so I did the integration in the (I suppose) right way. Here following you'll find the code, but this didn't solve the problem...


func paymentQueue(queue: SKPaymentQueue, updatedTransactions transactions: [SKPaymentTransaction]) {
        print("Received Payment Transaction Response from Apple");
       
        for transaction:AnyObject in transactions {
            if let trans:SKPaymentTransaction = transaction as? SKPaymentTransaction{
                switch trans.transactionState {
                case .Purchased:
                    print("Product Purchased");
                    queue.finishTransaction(transaction as! SKPaymentTransaction)
                    defaults.setBool(true , forKey: "admob_footer_purchased")
                    break;
                case .Failed:
                    print("Purchased Failed");
                    queue.finishTransaction(transaction as! SKPaymentTransaction)
                    break;
                case .Restored:
                    print("Already Purchased Restored");
                    queue.finishTransaction(transaction as! SKPaymentTransaction)
                default:
                    print("Default");
                    break;
                }
            }
        }
    }


Thank you!

The problem is, you deleted the account the purchase was made on. Since it no longer exists

you'll either have to recreate that account or contact Apple to resolve the issue.

I just deleted it from sandbox users (and now I'm no longer allowed to add it again - I didn't know 😟)


Do you think asking Apple to delete that account will finally solve the problem? Then, the code I posted abowe will avoid the problem to come up again?


Thank you again!

The problem you have is well documented and very sad. It is called 'the endless loop'. Search the forum archived. Be thankful you have only one unfinished transaction. You can contact apple and they can delete it but otherwise you are stuck. Always remember to finishTransaction and never ever delete a test user.

Thank you for your answer.


Do you think my code (posted above) will avoid another endless loop in the future?

I don't do Swift.

No problem, thank you!

Your code is correct for Swift. Now contact Apple and have them resolve the sandbox account purchase.

Great! I just sent an email to Apple (previously I heared from them by phone and they asked me to send an email to the iTunes Store support).


Waiting for a response within the next 48 hours... 🙂


Thanks for your help, I'll keep you updated!

Glad to hear it. Best of luck on the store once you get this matter sorted out.

Thank you very much! I'll keep you updated 🙂

Hey,

this was happenging to me for a long time, i tried some of the solutions without luck

I was getting tired as bascially i was asked to enter de password every time i used my phone.


I solved it by changing the bundle identifier. that easy,


Hope this helps,

Cheers