Xamarin Forms Appcenter如何获取安装ID

Xamarin Forms Appcenter how to get installation ID

我正在尝试获取 Appcenter 的安装 ID 以仅向选定的设备发送通知,但是 string installid = AppCenter.GetInstallIdAsync().ToString();

returns System.Threading.Tasks.Task1[System.Nullable1[System.Guid]]

string installid = AppCenter.GetInstallIdAsync().Result.ToString(); returns空字符串

documentation 声明您需要按如下方式检索 installId

System.Guid? installId = await AppCenter.GetInstallIdAsync();

您需要等待调用,然后才能转换 ToString。