LicenseInformation IsTrial 始终为真,即使在购买应用程序之后也是如此
LicenseInformation IsTrial is always true, even after buying the app
我已经在 Windows 商店发布了一个应用程序,但它暂时隐藏了,所以我可以测试。
应用程序中有试用版,可让您访问某个级别。我没有设置任何时间限制。当您购买游戏时,您应该可以访问所有级别。但是 "IsTrial" 始终为真。
private static LicenseInformation _licenseInformation = CurrentApp.LicenseInformation;
public static bool IsLevelEnabled(LevelViewModel level)
{
#if DEBUG
return true;
#else
if (_licenseInformation.IsActive)
{
if (_licenseInformation.IsTrial) //Problem, always true
{
if ([...])//some logic to check is level is enabled in Trial.
{
return true;
}
else
{
return false;
}
}
else //Should go here when you buy the app.
{
return true;
}
}
else
{
return false;
}
#endif
}
我的代码基于https://msdn.microsoft.com/en-us/library/windows/apps/xaml/Dn532253(v=win.10).aspx。
谢谢
编辑
别人在商店里买了我的应用,别以为他没有试用过。对他来说一切都很好。他可以访问所有级别。而且我还在试炼中。
确保您的应用与您的开发帐户相关联。
您 运行 您的应用是否处于调试模式?如果它在调试模式下是 运行,则您有 #if DEBUG ..
用于返回 true !
并尝试为此制作一个道具方法:
private bool IsTrial()
{
var li = CurrentApp.LicenseInformation;
if (li.IsActive)
{
return li.IsTrial;
}
else
{
return true;
}
}
我在其他电脑上试过没问题,所以是我在一台电脑上的账号有问题
所以代码没问题
我可以像 Nasser 所说的那样更改代码并每次都刷新许可证,但这对我来说没有必要。
在一台计算机上仍然有问题。我认为我不会在此代码中找到答案。
我已经在 Windows 商店发布了一个应用程序,但它暂时隐藏了,所以我可以测试。
应用程序中有试用版,可让您访问某个级别。我没有设置任何时间限制。当您购买游戏时,您应该可以访问所有级别。但是 "IsTrial" 始终为真。
private static LicenseInformation _licenseInformation = CurrentApp.LicenseInformation;
public static bool IsLevelEnabled(LevelViewModel level)
{
#if DEBUG
return true;
#else
if (_licenseInformation.IsActive)
{
if (_licenseInformation.IsTrial) //Problem, always true
{
if ([...])//some logic to check is level is enabled in Trial.
{
return true;
}
else
{
return false;
}
}
else //Should go here when you buy the app.
{
return true;
}
}
else
{
return false;
}
#endif
}
我的代码基于https://msdn.microsoft.com/en-us/library/windows/apps/xaml/Dn532253(v=win.10).aspx。
谢谢
编辑
别人在商店里买了我的应用,别以为他没有试用过。对他来说一切都很好。他可以访问所有级别。而且我还在试炼中。
确保您的应用与您的开发帐户相关联。
您 运行 您的应用是否处于调试模式?如果它在调试模式下是 运行,则您有 #if DEBUG ..
用于返回 true !
并尝试为此制作一个道具方法:
private bool IsTrial()
{
var li = CurrentApp.LicenseInformation;
if (li.IsActive)
{
return li.IsTrial;
}
else
{
return true;
}
}
我在其他电脑上试过没问题,所以是我在一台电脑上的账号有问题
所以代码没问题
我可以像 Nasser 所说的那样更改代码并每次都刷新许可证,但这对我来说没有必要。
在一台计算机上仍然有问题。我认为我不会在此代码中找到答案。