j3k0 / cordova-plugin-purchase

In-App Purchase for Cordova on iOS, Android and Windows
https://purchase.cordova.fovea.cc
1.29k stars 529 forks source link

Frequent PopUp asking to sign in to iTunes Store - Normal before release? #357

Closed yankustefan closed 5 years ago

yankustefan commented 8 years ago

I am testing my app on my Device and getting a PopUp asking to sign in to iTunes Store quite frequently, not only when I am purchasing. Usually after my Phone awakes from sleep or when I open or focus the app.

Is that normal, while I am testing?

I am testing the app built either as release in TestFlight and or as development installed via iTunes. The iTunes account used is listed as internal tester in iTunes Connect.

arielfaur commented 8 years ago

Yes, I am experiencing the same. I hope it goes away once the app is submitted an the in-app products approved.

yankustefan commented 8 years ago

Fingers crossed ;)

bwalsh commented 8 years ago

Any news on this does it only affect testflight users?

LukePulverenti commented 8 years ago

There's a number of identical issues opened because nobody ever wants to check the existing issue list before creating a new one. Therefore, the discussion has been scattered all throughout multiple conversations. They should be merged.

It definitely affects testflight users. In my testing it also affects users who disable appstore services on the device after purchasing an in-app product. An example use-case of that would be a parent unlocking an item then disabling the app-store. There are probably other scenarios where it's occurring but right now there's a lot of issue reporting and not enough people who'd like to help investigate.

bwalsh commented 8 years ago

Thanks. How can I help?

Currently, here is where I am:

I saw this patch this morning, I was going to try and distribute it to my users and see what happens https://github.com/joey91133/cordova-plugin-purchase/commit/44e27be3f3e812b910cb10ea1d5a084df8be4d70

LukePulverenti commented 8 years ago

There is another similar topic where the primary developer of this repository has indicated that that change could have negative repercussions. You'll have to find that.

osro commented 8 years ago

I'm having the very same issue as well.

Users are able to buy the item and store confirms that the item is bought, but after that the iTunes login screen keeps opening continuously. And the product won't get updated to "owned" state.

akrishnayadav commented 8 years ago

We used latest Cordova Purchase plugin 4.0.0. And Now. After the Inapp purchase through testflight using internal tester,

And if you loose the focus from the app (back to home page/ open any other app )

Then it is asking for the credentials to "Sign In to iTunes Store" only for one time. after providing the credentials once, Then it is not asking for the credentials continuously for that InApp purchase . (This is little better. )

Is there any better solution than this ?

yankustefan commented 8 years ago

Hi, I think that is as good as it gets. At least it works fine in production.

akrishnayadav commented 8 years ago

Thanks Stefan. On 24 Feb 2016 12:28 am, "Stefan Yanku" notifications@github.com wrote:

Hi, I think that is as good as it gets. At least it works fine in production.

— Reply to this email directly or view it on GitHub https://github.com/j3k0/cordova-plugin-purchase/issues/357#issuecomment-188080170 .

westonganger commented 8 years ago

Can someone confirm if this popup doesn't appear in production?

westonganger commented 8 years ago

I have even removed this plugin from my project, removed the platform and added it, logged out of the sandbox account and logged into another account, deleted the app and restarted the device. Its still popping up with this dialog for this app. I have a feeling this has to do with an unfinished purchase. Is anyone else experiencing the same thing?

calendee commented 8 years ago

@westonganger The purchases are associated with the device. I was dealing with this as well. The only way to stop this is to restore the device. Be sure NOT to use any backup that included those purchases. It's best to just restore from factory defaults. Painful? Yes. Necessary? Yes.

Also be sure to never actually log into the App Store via the Settings app. http://stackoverflow.com/a/9419120/75644

Pigsnuck commented 8 years ago

There is a much easier way than that, calendee. The problem occurs because the purchase queue is persistent on the device (which is why restoring it works but restarting doesn't).

All you need to do is go find inAppPurchase.m in the XCode project, and add the following line inside the loop of the following method (line 429 in my version):

Method:

Add this line (inside the loop [line 437 in my code]):

AND DON'T FORGET TO REMOVE THE LINE OF CODE AGAIN!!! Rebuilding your Cordova project will NOT remove the code, you will have to remove it yourself.

jlundmark commented 8 years ago

I am having a similar issue. It also keeps restoring the purchase and won't let me buy another. My product is set as a consumable and I am using PhoneGap Build to create the app file then testing it on my iPhone.

The only way to buy another consumable product is to use another sandbox user. If I do use another sandbox user it then will ask me for both users login info each time I run store.refresh(). I feel like the product is not finishing but I have it calling product.finish(). Please help!!

AbuHani commented 8 years ago

i solve this problem by using store.trigger("refreshed"); instead of store.refresh();

remisture commented 8 years ago

@AbuHani What exactly is happening when doing store.trigger("refreshed"); instead of store.refresh();?

AbuHani commented 8 years ago

No PopUp to restore purchases!

Md-Sadham commented 7 years ago

Then how the people use this plugin for purposes!

jlundmark commented 7 years ago

Thanks! Adding the following worked for me.

store.when("product").updated(function(product) { if(product.loaded && product.valid && product.state === store.APPROVED) { product.finish(); } }); store.trigger("refreshed");

Pigsnuck commented 7 years ago

Are you sure that store.trigger("refreshed") is really doing a store refresh, or is it just calling the event handler AS IF the store data had been refreshed?

Has anyone proved that the data is updated after calling store.trigger("refreshed")?

karuppasamypandian0856 commented 7 years ago

@Pigsnuck The above solution is not worked for me.

westonganger commented 7 years ago

I hate to suggest it here but why don't you try out the cordova-plugin-inapppuchase. It is very easy to use and actually works as advertised. https://github.com/AlexDisler/cordova-plugin-inapppurchase

jlundmark commented 7 years ago

I was also using an older version of the plugin. I updated it to the latest version 6.0.0. Then uninstalled the app and installed the new version. It did ask for me to login but the pop up I was getting went away. The code I added/changed is below:

store.when("Virtual Consultation").updated(function(product) { if(product.loaded && product.valid && product.state === store.APPROVED) { product.finish(); } });

store.refresh(); store.trigger("refreshed");

I did have store.refresh(); in there before.

I am not sure which one fixed it. But with all the changes it is working as expected.

karuppasamypandian0856 commented 7 years ago

@westonganger Yes. you said correctly that plugin very simple,light weight and working fine compare than this.But this same popup issue was common for me. I'm facing this issue in iPhone only does not in iPad.I don't know why.

j3k0 commented 7 years ago

The "ask-for-password" issue is one often encountered in development. I think when the device switch to the sandbox itunes server it'll ask for the password. It is not specific to cordova apps or this plugin.

The store.trigger("refreshed") thing is a bad hack. Except if you're calling store.refresh() multiple times (which you shouldn't), it has no effect.

See the code for store.refresh():

var initialRefresh = true;

store.refresh = function() {

    store.trigger("refreshed");
    if (initialRefresh) {
        initialRefresh = false;
        return;
    }
    // ...
    // the rest isn't executed on the first call to store.refresh()
}

As for the other plugin, the authors have stopped all work on it. It has less features, more unsolved bugs, support less platforms and has a way smaller user-base.

Pigsnuck commented 7 years ago

Thanks for the feedback, Jean-Christophe. I had already made some assumptions regarding your last post, but it's great to hear it from the product owner. ;)

My app (Paragliding Map) is currently in review with Apple, and uses subscriptions as well as supporting legacy users of the old in-app purchases. Let's see if the problem (multiple password popups) goes away in the live environment. I hope so.

karuppasamypandian0856 commented 7 years ago

@Pigsnuck _i congratulate you for get good response from App Store._Please let me know once you get response from app store.Here many of them eagerly waiting for your valuable response.Your answer may be fix this issue. I also hope

karuppasamypandian0856 commented 7 years ago

@j3k0 I thank you for your plugin support.Yes,i agree your plugin have more features compare than others.But we can't track where is the leakage.This popup prompt before splash screen came and even app in background state.

This problem not occurred in native APP development.Then how will you said, It is not specific to cordova apps or this plugin.I just asking you.

Pigsnuck commented 7 years ago

@karuppasamypandian0856 I suspect I know what is happening with a lot of those popups: I think iTunes requires a password to enter or exit the sandbox. This is why after testing your app, or even restarting your device, it might ask for a password. The reason for this (I suspect) is that another app is requesting a store response in the PRODUCTION store (not the sandbox). Because you logged into the sandbox for testing, iOS will ask you for your password again. Now you open your test app, and it asks for a password again because you have to log back into the sandbox. Etc, etc, etc.

The other reason I have seen for password popups is not calling finish() on transactions in the SKPaymentQueue (the store queue). It's obvious if this is your problem, because iOS will ask again and again and again, even if you cancel entering your password.

I will update this thread once my app is in the production environment. Let's see what spurious reason Apple has for failing my app during review this time (it's always something, isn't it?).

j3k0 commented 7 years ago

@karuppasamypandian0856 It happens also with the other plugin (see issues there) and I also see the same behavior using the plugin for the Adobe AIR platform.

Like @Pigsnuck, I believe the sandbox / production switch is the reason for the password popup. From experience it doesn't appear to happen on non-developers devices.

j3k0 commented 7 years ago

we can't track where is the leakage

You can enable verbosity DEBUG (see documentation). This is very verbose and should display info about pending purchases being stuck in queue (if there are).

j3k0 commented 7 years ago

There are a lot of rough edges with Apple's IAP development experience (even though it improved significantly since iOS 8). Restoring the device to factory default and creating a new Test User, is often a good idea when the device starts to act weirdly... for a lot of reasons (test users silently disabled, deleting a previously valid purchase product, old stuff that stays in device cache and won't refresh, ...)

karuppasamypandian0856 commented 7 years ago

@j3k0 Thank you for your valuable comments.

Generally many of them said if Payment queue is not cleared this prompt will occur.After Finish/Failed the purchases ,i called the below method to clear the list from Queue (this is a reason for i mentioned here). Then why this prompt occur. [[SKPaymentQueue defaultQueue] finishTransaction:transaction];

mcmahonc commented 7 years ago

I wonder if anyone can confirm if this problem persisted in the live App Store production environment.. the theory that links this problem to persistent the switching between sandbox and production users makes sense to me but I wonder if anyone can verify if this problem persisted when the app went live ? I have read many threads on this problem and all seem to be sandbox related .. thank you kindly !

rossi256 commented 7 years ago

I was into this problem long time and made my developers crazy about it - at the end we published the app and we do not have those frequent popups when the app is live, still in testing environment always... Don't want to put my hand in fire for it but in our case, no abnormal popups in production app...

mcmahonc commented 7 years ago

@rossi256 I really appreciate that cheers ! I can find forum after forum of discussions related to the sandbox environment but none for production so we will have to go for it . Will update this once I can confirm as useful for others facing the same issue .. likely to be a week or so before I can confirm

mcmahonc commented 7 years ago

This issue did not persist in our production environment, can only deduce this is a Sandbox related issue caused by constant signing in an out of sandbox and real iTunes accounts etc.

priyag676 commented 7 years ago

@j3k0 Hi, The issue mentioned above is also replicated on ionic app i.e. live on itunes app store, I am the using the previous version of the plugin. AlexDisler/cordova-plugin-inapppurchase#138

Dexus commented 7 years ago

see my answer in #315

I can only reproduce it when I have my phone with multiple sandbox accounts and/or live accounts and buyed with different accounts the products. I think it has a reason why apple prefer to use a own test device.

mcmahonc commented 7 years ago

Is TestFlight still on the phone ? Even if the live production app is installed I continue to get these if TestFlight is installed , once I delete TrsyFlight it goes away

On Fri 5 May 2017 at 07:50, Josef Fröhle notifications@github.com wrote:

see my answer in #315 https://github.com/j3k0/cordova-plugin-purchase/issues/315

I can only reproduce it when I have my phone with multiple sandbox accounts and/or live accounts and buyed with different accounts the products. I think it has a reason why apple prefer to use a own test device.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/j3k0/cordova-plugin-purchase/issues/357#issuecomment-299394971, or mute the thread https://github.com/notifications/unsubscribe-auth/AAckSDGe2Kwl6s8eQCx0YRFRcMf2_6_fks5r2saogaJpZM4Gyg1R .

adriano-di-giovanni commented 7 years ago

Does anybody of you use GoogleMobileAds SDK for iOS? If so, try to delay the store initialization. Does the popup still fires? If so, try to add

[GADMobileAds disableAutomatedInAppPurchaseReporting]; to your AppDelegate

Does the popup still fires?

jonathankau commented 6 years ago

We've been able to replicate this issue in production for users without sandbox accounts. Since we've been running into an issue where store.refresh() needs to be called twice in order for approved events to be fired for purchased products (https://github.com/j3k0/cordova-plugin-purchase/issues/536), we implemented something like:

  // register products

  // add callbacks

  store.ready(() => {
    console.log('In App Purchase : Store Initialized');
    store.refresh();
  });

  store.refresh();

Unfortunately, we now get this pop-up issue on iOS.

aaslun commented 6 years ago

I had this problem. It was resolved once the app went through release and got published. I removed the app and downloaded the newly published version from the app store. Once I started the app the popup fired again. Instead of just aborting it, this time I entered my credentials. The popup fired again, I repeated the authentication. And then it finally stopped nagging me. What a relief! I can now actually use my phone again. I had these popups appear all the time, like when you were texting something important and were in a hurry, ten popups in a row would appear. For whatever reason, Apple developers should be provided a way of resolving this in a quicker and more lenient way IMHO.

stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

HBArck commented 3 years ago

I'm having same issue as @aaslun , even when app is released I still see sign in popup only when I make store.order Registration of items inside app.components.ts the rest I have on my payment page and it is only 2 small functions. cc.fovea.cordova.purchase": "^10.1.1" @ionic-native/in-app-purchase-2": "^5.27.0"

registerEventsIAP2() {
    let productId = PaymentPage.REQUEST_PROMOTION;
   this.iap2.when(productId).approved((p: IAPProduct) => {
        this.ref.detectChanges();
        p.finish();
        this.createPost('paid');
        // return p.verify();
      });
}

buyPromotion() {
    this.registerEventsIAP2();

    let productId = PaymentPage.REQUEST_PROMOTION;

    this.iap2.order(productId).then(p => {
    }, e => {    alert(`Failed to purchase: ${e}`);    });
  }