2015-09-25 15 views
0

我已经在Windows商店发布了一个应用程序,但它暂时隐藏,所以我可以测试。许可信息IsTrial始终如此,即使购买应用程序后

在应用程序中有一个试用版,您可以访问某个级别。我没有任何时间限制。当你购买游戏时,你应该可以访问所有关卡。但是“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

感谢

编辑

别人买我的应用程序在商店,不要以为他试图审判。对他来说一切都很好。他可以进入各个层面。而我仍然陷入审判。

+0

我的水晶球说,你忘了[关闭模拟](http://stackoverflow.com/questions/16241881/simulating-a-windows-8-store-apps-purchase)。 –

+0

我卸载所有内容,然后尝试从商店进行全新安装。我没有碰到WindowsStoreProxy.xml,我没有使用CurrentAppSimulator。我是否需要编写WindowsStoreProxy.xml? – Alxx

回答

0

我试图在其他计算机上,它是很好,所以它与我的帐户一台计算机上的一个问题。

所以代码没问题。

我可以更改Nasser所说的代码,并且每次都刷新许可证,但这对我没有必要。

在一台计算机上仍然存在问题。把我不认为我会在这个代码中找到anwser。

0

确保您的应用与您的开发者帐户相关联。

你在调试模式下运行你的应用程序吗?而你的#if DEBUG ..如果在调试模式下运行则返回true!

,并设法使道具的方法为:

private bool IsTrial() 
    { 
     var li = CurrentApp.LicenseInformation; 
     if (li.IsActive) 
     { 
      return li.IsTrial; 
     } 
     else 
     { 
      return true; 
     } 

    } 
+0

该应用已关联。我尝试了它的在线版本(我也购买了该应用程序),也尝试在Visual Studio中发布。更改本地变量的许可似乎没有帮助。 IsActive永远是真的,审判也是如此。 – Alxx

相关问题