locked
PaymentWithProduct RRS feed

  • Question

  • User20659 posted

    Hi Xamarin,

    It said that "PaymentWithProduct" is obsolete, and to "Use FromProduct (SKProduct) instead." at https://developer.xamarin.com/api/member/MonoTouch.StoreKit.SKPayment.PaymentWithProduct/p/MonoTouch.StoreKit.SKProduct/

    Would you please help to let me know the details how to call FromProduct? And why the obsolete api is still be used in https://github.com/xamarin/ios-samples/blob/0b1bda6a7105060a4d01ffa7f9064ca4564059ac/StoreKit/SharedCode/PurchaseManager.cs

    The problem is that sometimes the obsolete iOS APIs (Xamarin Studio warns) does not work really as Xamarin Studio said, but some APIs still work, like PaymentWithProduct.

    Br,

    Saturday, October 15, 2016 6:44 AM

Answers

  • User12211 posted

    @HaoLi said: Hi Xamarin,

    It said that "PaymentWithProduct" is obsolete, and to "Use FromProduct (SKProduct) instead." at https://developer.xamarin.com/api/member/MonoTouch.StoreKit.SKPayment.PaymentWithProduct/p/MonoTouch.StoreKit.SKProduct/

    Would you please help to let me know the details how to call FromProduct?

    Just call SKPayment.CreateFrom(product) instead of SKPayment.PaymentWithProduct(productId). You'll need to pass the SKPayment object into the PurchaseProduct method instead of the appStoreProductId string.

    And why the obsolete api is still be used in https://github.com/xamarin/ios-> samples/blob/0b1bda6a7105060a4d01ffa7f9064ca4564059ac/StoreKit/SharedCode/PurchaseManager.cs

    Because that sample is really old.

    The problem is that sometimes the obsolete iOS APIs (Xamarin Studio warns) does not work really as Xamarin Studio said, but some APIs still work, like PaymentWithProduct.

    Yes, sometimes their obsolete warnings don't match what they actually implemented. I was able to figure out what to call by looking at the "Foundation.Export" attribute in the documentation and matching that up with the Obj-C documentation from Apple to see which method did what you wanted.

    I've reported the out-of-date guide and incorrect API documentation, so hopefully it will get updated.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Saturday, October 15, 2016 3:03 PM

All replies

  • User12211 posted

    @HaoLi said: Hi Xamarin,

    It said that "PaymentWithProduct" is obsolete, and to "Use FromProduct (SKProduct) instead." at https://developer.xamarin.com/api/member/MonoTouch.StoreKit.SKPayment.PaymentWithProduct/p/MonoTouch.StoreKit.SKProduct/

    Would you please help to let me know the details how to call FromProduct?

    Just call SKPayment.CreateFrom(product) instead of SKPayment.PaymentWithProduct(productId). You'll need to pass the SKPayment object into the PurchaseProduct method instead of the appStoreProductId string.

    And why the obsolete api is still be used in https://github.com/xamarin/ios-> samples/blob/0b1bda6a7105060a4d01ffa7f9064ca4564059ac/StoreKit/SharedCode/PurchaseManager.cs

    Because that sample is really old.

    The problem is that sometimes the obsolete iOS APIs (Xamarin Studio warns) does not work really as Xamarin Studio said, but some APIs still work, like PaymentWithProduct.

    Yes, sometimes their obsolete warnings don't match what they actually implemented. I was able to figure out what to call by looking at the "Foundation.Export" attribute in the documentation and matching that up with the Obj-C documentation from Apple to see which method did what you wanted.

    I've reported the out-of-date guide and incorrect API documentation, so hopefully it will get updated.

    • Marked as answer by Anonymous Thursday, June 3, 2021 12:00 AM
    Saturday, October 15, 2016 3:03 PM
  • User20659 posted

    Great, thanks much @DaveHunt

    Saturday, October 15, 2016 10:02 PM
  • User237535 posted

    Well, now the problem is:

    SKPayment.CreateFrom
    //     Developers should not use this deprecated method. Developers should use 'FromProduct
    //     (SKProduct)'' after fetching the list of available products from 'SKProductRequest'
    //     instead.
    

    What is this FromProduct(SKProduct) they speak of? WTF is going on? Where is the method?

    Friday, January 11, 2019 10:17 AM