Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck on "Sign-in Required" infinite loop: App keeps asking for itunes password #136

Open
brunolemos opened this issue Nov 10, 2017 · 19 comments

Comments

@brunolemos
Copy link

So it shows the "Sign-in Required" alert.
If I press Cancel, it will close it and reopen automatically right after.
Same thing if I type the correct password and press Continue.

Is this an issue with this library, react native, ios, or what?

React Native 0.49.5
iOS 11.2

@brunolemos brunolemos changed the title Stuck on infinite loop: App keeps asking for itunes password Stuck on "Sign-in Required" infinite loop: App keeps asking for itunes password Nov 10, 2017
@superandrew213
Copy link
Contributor

Do you try to restore purchases in the background?

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

@superandrew213 How would it be like in the background?
I just call InAppUtils.restorePurchases in the foreground inside a saga

@superandrew213
Copy link
Contributor

Do you call this when the user presses a button or do you call it automatically in the background to restore all the user's purchases? InAppUtils.restorePurchases will trigger a the "Sign-in Required" prompt when you call it.

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

Oh right. There are both cases:

  • InAppUtils.receiptData triggers automatically a few seconds after the user open the app
  • InAppUtils.restorePurchases triggers manually when the user taps on Restore

But why would this cause an infinite loop? Shouldn't it just ask once at max?

@superandrew213
Copy link
Contributor

I'm triggering InAppUtils.receiptData in the background too but am not having any issues with it so far. However I had the same issue as you if I tried to restore the purchases in the background too.

Try disabling InAppUtils.receiptData and see what happens.

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

No luck. Even after I closed all apps the alert keeps showing to me asking for the password, even if I type it correctly... Seems to be an ios bug.

@superandrew213
Copy link
Contributor

Try restarting your phone and disable InAppUtils.receiptData

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

Unfortunately didn't work. Infinite loop is still there, even after closing the app...

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

Maybe it's this: https://stackoverflow.com/a/24954219/2228575

Maybe there is some place that should call finishTransaction but it's not calling?

[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
}
case SKPaymentTransactionStateRestored:
[[SKPaymentQueue defaultQueue] finishTransaction:transaction];
break;
case SKPaymentTransactionStatePurchasing:
NSLog(@"purchasing");
break;
case SKPaymentTransactionStateDeferred:
NSLog(@"deferred");
break;
default:
break;

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

So, I added a console.log:
NSLog(@"xxx updatedTransactions %i", queue.transactions.count);

It's showing there are more than 40 transactions in the queue!
But all of them with SKPaymentTransactionStateRestored state.

It definitely seems to be related to finishTransaction not being called somewhere or something like that. Right?

If I tap Cancel 40 times it stops showing the alert, but if I click to restore again they come back.

@superandrew213
Copy link
Contributor

After you clear the queue, if you press restore once, you get 40 transactions in the queue?

@chirag04
Copy link
Owner

@brunolemos if you have 40 transaction in the queue then it means you were testing something and killed/crashed the app before the transaction finished. You will have to manually clear the queue for now

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

After you clear the queue, if you press restore once, you get 40 transactions in the queue?

Not 40, but a lot of them (~6?).

You will have to manually clear the queue for now

Do you mean by code? But what if the users get in this state? I'd like to do some fix that would work for them too

PS there is a possibility this won't happen on production. Found some people saying this may be a bug related to testflight

@chirag04
Copy link
Owner

there is a possibility this won't happen on production

Yes. that's the idea. Your app won't be approved by apple if this is happening systematically.

@brunolemos
Copy link
Author

brunolemos commented Nov 10, 2017

Just another info, this is happening to me and all the team that tested (another 2 people) that are not developers

@chirag04
Copy link
Owner

i would suggest adding a break point in that switch and see if it's going in a case where we don't have finishTransaction. obviously queue should be flushed before this break point to isolate the problem. you can comment out callback calls to let the queue flush itself first.

@jeffie
Copy link

jeffie commented Nov 27, 2017

It seems a bug for iOS11,you can try like this, This is what worked for me:
https://stackoverflow.com/questions/46257633/ios-11-is-in-app-purchase-testing-using-a-sandbox-user-keeps-asking-to-sign-in

@RomanVolkov
Copy link

when you ask for StoreKit to restore purchases it places all previous transaction ins queue. and they should be finished again too

@awchang56
Copy link

I've had this affecting my phone for months. and I found a post that said, if your restore purchases button in your app is working correctly. Run the app on the affected that you think caused the sandbox sign-in required alert, tap the restore purchases button in your app, and it should fix it once and for all, if somehow you do something to make it come back again, you can just do the same thing, hit restore purchases and it should go away again. it's like hitting the reset button. Before doing this, I had exactly 55 alerts that would pwn my phone for 45 straight seconds of tapping and it would happen once or twice a day. Now it never happens. I hope this is helpful.

stack overflow reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants