我已添加到 WMAppManifest.xml:
<Capability Name="ID_CAP_IDENTITY_DEVICE" />
<Capability Name="ID_CAP_IDENTITY_USER" />
那么为什么我总是从以下位置获取空字符串:
public static string GetWindowsLiveAnonymousID()
{
int ANIDLength = 32;
int ANIDOffset = 2;
string result = string.Empty;
object anid;
if (UserExtendedProperties.TryGetValue("ANID", out anid))
{
if (anid != null && anid.ToString().Length >= (ANIDLength + ANIDOffset))
{
result = anid.ToString().Substring(ANIDOffset, ANIDLength);
}
}
return result;
}
它似乎不能很好地处理 TryGetValue ......有人有线索吗?