IAP导致APP崩溃 [英] IAP lead to APP crash

查看:97
本文介绍了IAP导致APP崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,

当我将IAP添加到游戏中时,无论购买成功还是失败,游戏都会崩溃.并且消耗品无法再购买,因为游戏崩溃时购买ID未能提交给Microsoft.我的游戏是  本机c ++.   以下是我的代码:

When i add IAP to the game, the game crashed no matter purchase succeed or failed. and the consumable goods could not be purchase any longer , as the purchase ID failed to submit to microsoft when game crashed. my game is  native c++ .  The following is my code :

		auto licenseInformation = CurrentApp::LicenseInformation;

		if (!licenseInformation->ProductLicenses->Lookup(wsID)->IsActive ||  licenseInformation->ProductLicenses->Lookup(wsID)->IsConsumable)
		{
			create_task(CurrentApp::RequestProductPurchaseAsync(wsID, false)).then([& , this](task<Platform::String^> currentTask)
			{
				try
				{
					currentTask.get();

					auto licenseInformation = CurrentApp::LicenseInformation;

					if (licenseInformation->ProductLicenses->Lookup(wsID)->IsActive)
					{
                                                // IAP succeed
						CurrentApp::ReportProductFulfillment(wsID);
					}
					else
					{
                                                // IAP failed
					}
				}
				catch(Platform::Exception^ exception)
				{
					// Exception  in IPA
				}
			});
		}
		else
		{
			//has bought;
		}

您能帮我解决这个问题吗?

could you  help me to solve this issue.

谢谢

推荐答案

这很可能是由于它是从主应用线程中调用的.

This is likely caused because it was called from the main app thread.

The same problem as described in the Release Notes for CurrentApp::LicenseInformation->IsTrial.

希望这会有所帮助,
标记

Hope this helps,
Mark


这篇关于IAP导致APP崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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