UWP - class PhoneLine not found [duplicate]

2019-02-25 03:31发布

问题:

This question already has an answer here:

  • How to dial a Number in C# windows universal 10 1 answer

I'm trying to make phone calls from my application. I'm supposed to use PhoneLine from namespace Windows.ApplicationModel.Calls;. But PhoneLine is not in Windows.ApplicationModel.Calls;, however according to documentation it should be there. When I add it to source code like Windows.ApplicationModel.Calls.PhoneLine this and hover over it, there is a hint saying:

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

So I tried to access PhoneLine through Windows.Foundation.UniversalApiContract', but VS says that PhoneLine does not exist in Windows.Foundation.UniversalApiContract eighter.

I have checked Phone Call and VOIP Calls in app manifest with no success. Can you help me with that? Thanks.

回答1:

You have to include Windows Mobile Extensions for the UWP. Just add a new reference and go into Univerval Windows/Extensions.

If needed, you can find the following sample on github : https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/PhoneCall