gpt4 book ai didi

c# - Xamarin 形成 UWP 缺失电话调用管理程序集

转载 作者:行者123 更新时间:2023-11-30 20:30:13 28 4
gpt4 key购买 nike

问题

学习 Xamarin 大学类(class) XAM120 .在将我的 IDial 实现添加到我的 UWP 项目时遇到障碍。出于某种原因,我的项目没有在我的系统上使用 PhoneCallManager API。

错误:

Error CS1069
The type name 'PhoneCallManager' could not be found in the namespace 'Windows.ApplicationModel.Calls'. This type has been forwarded to assembly 'Windows.Foundation.UniversalApiContract, Version=3.0.0.0, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime' Consider adding a reference to that assembly.

代码:

using System.Threading.Tasks;
using Windows.Foundation.Metadata;
using Phoneword.UWP;
using Xamarin.Forms;

namespace Phoneword.UWP
{
public class PhoneDialer : IDialer
{
public Task<bool> DialAsync(string phoneNumber)
{
if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.Calls.CallsPhoneContract", 1, 0))
{
Windows.ApplicationModel.Calls.PhoneCallManager.ShowPhoneCallUI(phoneNumber, "Phoneword");
return Task.FromResult(true);
}

return Task.FromResult(false);
}
}
}

最佳答案

将以下引用添加到您的 UWP 项目:

enter image description here

关于c# - Xamarin 形成 UWP 缺失电话调用管理程序集,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45157576/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com