Hier ist die Logik: < /p>
this.store.initialize([
{
id: FOODIE_PLAN_ID_MONTHLY,
type: this.store.PAID_SUBSCRIPTION, // Access directly
platform: this.store.APPLE_APPSTORE // Access directly (use correct key)
}
])
.then(() => {
console.log('[IAP Initialize] Store initialized successfully.');
this.isInitializing.set(false);
this.loadProductDetails(); // Load details after successful init
})
.catch((err: CdvPurchasePlugin.CdvPurchaseError) => {
console.error('[IAP Initialize] Store initialization failed:', err);
this.isInitializing.set(false);
});
async loadProductDetails(): Promise {
console.log('[IAP LoadProducts] Loading product details...');
try {
// Retrieve the cached product state after initialize/refresh
const product = this.store.get(FOODIE_PLAN_ID_MONTHLY);
if (product) {
this.zone.run(() => {
this.products.set([product]);
});
console.log(
'[IAP LoadProducts] Product details loaded from cache:',
product
);
} else {
console.warn('[IAP LoadProducts] Product details not yet available.');
this.zone.run(() => {
this.products.set([]);
});
}
} catch (error) {
console.error('[IAP LoadProducts] Failed to get product details:', error);
this.zone.run(() => {
this.products.set([]);
});
} finally {
this.zone.run(() => {
this.isLoadingProducts.set(false);
});
}
}
< /code>
Hier ist das Protokoll von meinem realen Telefon: < /p>
< /code>
Nicht sicher, ob ich richtig verstehe oder nicht. Wenn wir die Produkte im App Store hinzufügen, verbinden Sie sich. Sollte es verfügbar sein, wenn Sie lokal über Xcode testen?