我正在尝试获取 Windows Phone 8 中的 device_id
。我试过这样做:
byte[] myDeviceID = (byte[])Microsoft.Phone.Info.DeviceExtendedProperties.GetValue("DeviceUniqueId");
string DeviceIDAsString = Convert.ToBase64String(myDeviceID);
还有这个:
DeviceExtendedProperties.GetValue("DeviceUniqueId").ToString();
两者都导致以下异常:
An exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.Phone.ni.dll but was not handled in user code
Additional information: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
我该如何解决这个问题?
最佳答案
您需要在应用程序 list 文件中添加所需的功能。特别是,尝试添加此功能:
ID_CAP_IDENTITY_DEVICE
供引用:
关于c# - Microsoft.Phone.ni.dll 中的 UnauthorizedAccessException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24446206/