Closed Psionyx closed 4 years ago
Hey @Psionyx , nativeValue
is a native object, so you can't really log it afaik. And per your description it does not log null
so it is not null
đŸ˜‰
Ok that makes sense. So then it's undefined according to the error message. Am I doing something that loses the type of the native object?
Not that I can see. But you also never use the purchaseInitPromise
you need to ensure that the plugin is initialized before calling getProducts
. Also from the error seems the product
itself is null, but not 100% sure.
11 line of the first set of code I placed is where I run that which is in app.component.ts
But I'm reimporting in in-app-purchase.component.ts so maybe that's the problem. Let me play around with it a bit
On L11 you initialize the promise, but you are not using it anywhere else. You need to have code similar to the one in the readme:
import { Product } from "nativescript-purchase/product";
(global as any).purchaseInitPromise.then(() => {
purchase.getProducts().then((products: Array<Product>) => {
products.forEach((product: Product) => {
console.log(product.productIdentifier);
console.log(product.localizedTitle);
console.log(product.priceFormatted);
});
});
});
No further response so closing this one for now. In case you still have problems, please provide more details.
I'm running this in a NativeScript Angular app on an iOS Device. I'm able to retrieve my products, along with prices and description from Apple. However, when go to purchase an item I get : CONSOLE ERROR [native code]: ERROR TypeError: undefined is not an object (evaluating 'product.nativeValue')
I'm initializing the products in app.component.ts, in-app-purchase.component.ts respectively:
However when I log the product, All of the other values are available but nativeValue is null: nativeValue:{} Do I need to set the values to nativeValue?