PeterStaev / nativescript-purchase

:moneybag: A NativeScript plugin for making in-app purchases!
Apache License 2.0
83 stars 28 forks source link

"Error decoding object" on getProducts() call on iOS 13 #87

Closed yoat closed 4 years ago

yoat commented 4 years ago

My code works on Android and iOS 12, but on iOS 13 there is an exception being thrown in the nativescript-purchase getProducts() call.

import * as purchase from "nativescript-purchase";
// ... later on we call getProducts:
 purchase
        .getProducts()
        .then(res => {
          this.products = res;
          console.log(`found ${res.length} products`);
          resolve(this.products);
        })
        .catch(e => {
          console.log(`error getting products: ${e}`);
          reject(e);
        });

The output from within the catch block above is: "error getting products: Error: Error decoding object"

Is there something we have to do differently for iOS 13?

yoat commented 4 years ago

Can you confirm the latest version of “PeterStaev/nativescript-purchase” and/or “@proplugins/nativescript-purchase” has been tested to work with iOS 13?

PeterStaev commented 4 years ago

Hey @yoat , looking at this seems this is a known problem with the new XCode/iOS Sim. Can you try your code on an actual device or reboot the sim/xcode/mac?

From what I know there haven't been any changes to the native APIs in iOS13 and since the plugin directly uses those APIs it should be working just fine. But I haven't tested it personally.

yoat commented 4 years ago

I'm running it on actual hardware. The iOS simulators do not support IAPs.

The error I posted is from a debug session on a iOS 13 device. The same code that works on iOS 12 hardware doesn't work on iOS 13 hardware.

PeterStaev commented 4 years ago

Another post also suggests some problems with dependencies. Are you using any other plugins in your project that might be using some cocoa pods that might be outdated? Can you try to simulate the problem on a blank project with just the purchase plugin?

And for your reference, specifically the getProducts() function works perfectly fine in Simulators 😉 The purchase workflow that initiates an actual purchase is what doesn't work.

PeterStaev commented 4 years ago

No further response so closing this one for now. In case you still have problems, please provide more details.