在InAppBillingPlugin for Xamarin之后,在应用内购买无法连接到iTunes Store iOS 12 [英] In app purchase cannot connect to itunes store ios 12 following InAppBillingPlugin for Xamarin

查看:200
本文介绍了在InAppBillingPlugin for Xamarin之后,在应用内购买无法连接到iTunes Store iOS 12的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试按照插件在应用程序中测试应用购买.我还检查了以及成千上万的其他官方/非官方文章,但没有结果.我不认为我的代码中有问题,因为我要求另一个开发人员与我分享他的代码,并在我的应用程序中使用它.在他的项目中,此代码可以完美运行,但是我有InAppBillingPurchaseException无法连接到Itunes商店".在输入沙箱凭据之前,我还注销了真实帐户.这是代码,但是我不认为问题出在这里:

I am trying to test in app purchases in my application following plugin. Also I have checked this and thousands of other officical/not official articles but there is no result. I do not thins there is a problem in my code because I asked another developer to share me his code and I use it in my app. In his project this code works perfect but I have InAppBillingPurchaseException "Can not connect to Itunes Store". I also logged out of my real accounts before entering sandbox credentials. This is the code but the I do not think the problem is here:

public async Task<bool> PurchaseItemAsync()
    {
        var billing = CrossInAppBilling.Current;
        LastExceptionMessage = null;

        try
        {
            var connected = await billing.ConnectAsync();
            if (connected == false)
                return false;

            var purchase = await billing.PurchaseAsync(_kProductId, ItemType.InAppPurchase, _kPayload);

            if (purchase == null)
                return false;
            else if (purchase.State == PurchaseState.Purchased)
                return true;
        }
        catch (InAppBillingPurchaseException ex)
        {
            OnPurchaseException(ex);
        }
        catch (Exception ex)
        {
            //Dlog.Error("Issue connecting: " + ex);
            LastExceptionMessage = ex.Message;
        }
        finally
        {
            await billing.DisconnectAsync();
        }

        return false;
    }

推荐答案

在我的情况下,我的应用中的bundleID与在应用内购买"的产品ID不匹配.我的应用程式程式码中有套件编号 com.xam.sample .但是产品ID是 testiap .因此,我使用productID com.xam.sample.testiap 创建了IAP,从而能够解决该错误.

In my case, bundleID in my app was not matching with the product id of In App purchase. I had bundle ID com.xam.sample in my app code. But product ID was testiap. So I created IAP with productID com.xam.sample.testiap and I was able to solve that error this way.

这篇关于在InAppBillingPlugin for Xamarin之后,在应用内购买无法连接到iTunes Store iOS 12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆