-
-
Notifications
You must be signed in to change notification settings - Fork 531
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
[iOS] Appstore products appear to load, but products list is empty, Appstore Plugin undefined. #1394
Comments
The list of products is empty because the App Store adapter didn't reach the "ready" state. I wonder if it will work with the integration of a receipt validation service? The use case is more broadly tested. You can try this quickly with a free account on https://www.iaptic.com/ |
smooth method to "recommend" your company's services... but honestly was hoping not to need any more accounts to use iap. going to test with the free account but really sad that I have to use a service to get a free component to function. |
how do we integrate the receipt validation service? the documentation links: |
You don't have to. I'm trying to understand what doesn't work in your case. As far as I know you're the only user with this issue, so I'm trying to eliminate possible reasons. The broken link and outdated screenshots are fixed. |
That was rude of me. I am sorry. It was uncalled for. |
should I attach my iap connection logic? |
it ends up allowing the appstore to initialize and the appstore is available, but the list is still empty and trying to get a product is undefined. later test show that while the appstore adapter is defined now, it is not "ready" after initializing the store. |
I have a MVP of the project (takes out all the wrapping stuff and just the iap, which still doesn't connect. if that would be helpful? |
It looks like the CdvPurchase plugin is loaded twice. I added this in the service constructor (right after "CdvPurchase is defined") (CdvPurchase as any).createdAt = new Date(); And this: (CdvPurchase as any).debuggedAt = new Date(); In the debug_Purchases() function. Just after startup, when I've seen the "CdvPurchase is defined" log message, I open Safari's developer tools, but ... clicking the debug button I get Somehow the CdvPurchase object used by the service is different from the global object, or this global object has been overiden. Quick test: adding In the constructor: Also notice, in This is the root of the issue. I have no idea what triggers this "double loading" of the plugin, working on a workaround... NOTE: Sometime at startup I get this logs:
From this code: this.logger.log("CdvPurchase IS defined!!");
const store = CdvPurchase.store;
store.verbosity = CdvPurchase.LogLevel.DEBUG; It means there's really something fishy with the way the plugin's JavaScript is being loaded by the bundler. |
thank you for continuing to work on this, I saw you push a couple of other changes, but are they not enough to solve the issue? |
No, it didn't solve the issue, I tried a few quick fix that I thought would be simple... but eventually it's not that simple, as it either broke access to CdvPurchase's enums or the CdvPurchase.store object. I have to step through what your app is doing to figure out how is this happening in the first place and get a better understanding. I see that the code of the plugin is present in the |
hrm... that is odd. it would explain why my particular project isn't working while others are just fine, if that is the case. I take it the mvp project helps? |
MVP helps, because it allows to reproduce the issue. |
Look, the 2 "CdvPurchase.store" instance have different types: One is "Store" the other is "F", I guess the second one is from a minified version of the same code while the first is the non-minified version. So the problem definitely isn't with the plugin, just that you somehow bundle and load the code twice. |
I see how that can be troublesome... odd. I don't know why I am loading the unminified version and the minified version at the same time... |
I believe capacitor is probably already loading the plugin's js and
angular's build chain also do.
…On Mar 20, 2023 at 18:53:50, John M Davis Jr ***@***.***> wrote:
I see how that can be troublesome... odd. I don't know why I am loading
the unminified version and the minified version at the same time...
—
Reply to this email directly, view it on GitHub
<#1394 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABO3CNT767OK6KHZY47COTW5CDR5ANCNFSM6AAAAAAVYPUDEI>
.
You are receiving this because you modified the open/close state.Message
ID: ***@***.***>
|
ah. ok. armed with that I can look to see how to break the double loading. thank you for your hard work! |
Maybe there's something I could do in the plugin to distribute it in a way
that better suits your case. Let me know. I keep digging a little on your
issue.
…On Mar 20, 2023 at 18:59:14, John M Davis Jr ***@***.***> wrote:
ah. ok. armed with that I can look to see how to break the double loading.
thank you for your hard work!
Message ID: ***@***.***
com>
|
will do. I don't know how I double loaded the code, will try some unloading/reloading methods to see. seems like an edge case but if it helps make your codebase more resilient, maybe some minor reworking would be good. |
I found a fix that works here at least: In your code, replace: import "cordova-plugin-purchase"; with: import 'cordova-plugin-purchase/www/store.d'; This way, angular only includes the typings, not the actual code of the plugin. |
trying the updated input and pushed to device, this is the result. |
Oh yeah, maybe because I made this change to your code's checkReady as well:
async checkReady() {
return new Promise<void>(resolve => {
const wait = () => {
if(!window.CdvPurchase || !window.CdvPurchase.store) {
Added this to the if condition: || !window.CdvPurchase.store
|
And make sure to remove the cordova-pluing-purchase import from iapCatalog as well |
did that. added your extra check... still the same exception... |
with the setup you provided
|
My edited project, works fine here (notice I changed app ID in XCode project, might have to be reverted to your own). |
|
will try it :D... and ha. ok. |
OK! whatever you did it works on your version. so now I get to find the differences between that edited and my local one. yay! |
is the purchase supposed to show a confirmation before popping up the customary apple purchase dialog? I am only seeing the "type Y for purchase" and not the actual in-app purchase view. |
Observed behavior
and on the app none of the products are visible?
after all this, everything looks great, but inspecting the appstore adapter
is undefined. I have In-App Purchases enabled in the XCode, and my implementation follows all the tutorials (for the most part) yet this is happening...
Expected behavior
The CdvPurchase.store.products list has the loaded products, or at least the appstore adapter reporting itself as undefined.
System Info
XCode v 14.2
iMac MacOS Ventura 13.2.1
Capacitor v. 4.6.0 (capacitor apps are based off cordova, don't see how this would make a difference here)
The text was updated successfully, but these errors were encountered: