Skip to content

Commit

Permalink
Merge pull request #433 from JPZV/master
Browse files Browse the repository at this point in the history
Fixed deprecated warning from SKPayment.CreateFrom(string) (Issue #432)
  • Loading branch information
jamesmontemagno committed Dec 26, 2021
2 parents 4377773 + 16fd940 commit 4e23d9d
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions src/Plugin.InAppBilling/InAppBilling.apple.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,14 @@ async Task<SKPaymentTransaction> PurchaseAsync(string productId)

paymentObserver.TransactionCompleted += handler;

#if __IOS__ || __TVOS__

var payment = SKPayment.CreateFrom(productId);
#else

var products = await GetProductAsync(new[] { productId });
var product = products?.FirstOrDefault();
if (product == null)
throw new InAppBillingPurchaseException(PurchaseError.InvalidProduct);

var payment = SKPayment.CreateFrom(product);
//var payment = SKPayment.CreateFrom((SKProduct)SKProduct.FromObject(new NSString(productId)));
#endif
SKPaymentQueue.DefaultQueue.AddPayment(payment);

return await tcsTransaction.Task;
Expand Down

0 comments on commit 4e23d9d

Please sign in to comment.