this part of code (#if NETFX_CORE) not woking in store:
http://pastie.org/10497010
I get IAP list for windows universal 10 phone, but fail for windows universal 8.1 phone.
In other words, this function is unstable. I have not found sample code. Please tell me what I missed and how to achieve stable result of this function.
#region init request
public void Initialize(string key, ServerIAPDesc[ ] descs)
{
UnityEngine.WSA.Application.InvokeOnUIThread(async () => await Initialize2(descs), true);
}
private async Task Initialize2(ServerIAPDesc[ ] descs)
{
_gameServerDescs = descs;
try
{
var info = await CurrentApp.LoadListingInformationAsync();
OnLoadListingInformation(info);
}
catch (Exception ex)
{
Debug.LogError(string.Format("Init Win IAP: " + ex.Message));
if (onFail != null) onFail();
}
}
Why that async/await?
Wouldn’t this be enough:
UnityEngine.WSA.Application.InvokeOnUIThread(() => Initialize2(descs), true);
Those async/await you’re using around might be the problem. await in method running on UI thread is a bad thing in general.
BloodJohn:
My application actually published, but IAP not working after download from windows store.
Try asking here http://social.msdn.microsoft.com/Forums/windowsapps/en-US/home?forum=wpdevelop
Thanks for the advice.
I wrote a question for them,
but I’m not sure that the engineers from MS can understand the nuances of development for Unity3D.
CurrentApp is not a Unity API… It’s from MS .NET, also you said it’s not working, but you didn’t specify what exactly is not working, is it crashing, returning NullReference exception,etc?
If you build the app under vs2015 - IAP works.
But when you build the app under vs2013 - IAP fail.
Also delete Tags from IAP dev panel. After deleting Tags - it’s working.
I am sorry, but that’s almost zero information, why does it fail? Any errors in the Output window or log?
I apologize for the impoliteness. I have no logs from production and I have no idea how to get them from the phone.
Download https://wptools.codeplex.com/ , that way you’ll connect to phone and will be able to acquire UnityPlayer.log