Я установил плагин биллинга в приложении в свой проект Xamarin Forms: Plugin .
Сначала я хочу использовать его на iOS, но плагин не работает. Он показывает следующую ошибку: Plugin.InAppBilling.Abstractions.InAppBillingPurchaseException: Cannot connect to iTunes Store
at Plugin.InAppBilling.InAppBillingImplementation.PurchaseAsync (System.String productId, Plugin.InAppBilling.Abstractions.ItemType itemType, System.String payload, Plugin.InAppBilling.Abstractions.IInAppBillingVerifyPurchase verifyPurchase) ..
Я думаю, что мой productId или полезная нагрузка неверны, что мне туда вставить? Вот мой код:
try
{
var productId = "mySKU";
var connected = await CrossInAppBilling.Current.ConnectAsync();
if (!connected)
{
//Couldn't connect to billing, could be offline, alert user
return;
}
//try to purchase item
var purchase = await CrossInAppBilling.Current.PurchaseAsync(productId, ItemType.Subscription, "payload");
if (purchase == null)
{
//Not purchased, alert the user
}
else
{
//Purchased, save this information
var id = purchase.Id;
var token = purchase.PurchaseToken;
var state = purchase.State;
}
}
catch (Exception ex)
{
Console.WriteLine(ex);
//Something bad has occurred, alert user
}
finally
{
//Disconnect, it is okay if we never connected
await CrossInAppBilling.Current.DisconnectAsync();
}
Надеюсь, кто-нибудь может мне помочь. Заранее спасибо.