[UWP] ChatMessage和ContactPicker [英] [UWP]ChatMessage and ContactPicker
问题描述
我正在开发一个位置应用程序,因为我想通过短信为选定的联系人分享我的位置。为了获得联系我在这里使用联系人选择器的问题是当我选择联系人时它完全正常工作和
发送短信我得到以下例外和代码也在那里
对于发送短信,我写下以下代码。
var chatMessage
= < span style ="color:#0000ff; font-size:small"> new ChatMessage ();
chatMessage.Body =
"这是我当前的位置" +
" https://www.bing.com/mapspreview/?q =" +
geoposition.Coordinate.Point.Position.Latitude.ToString( " 0.00" )
+ "," + geoposition .Coordinate.Point.Position.Longitude.ToString( " 0.00" < span style ="font-size:small">);
chatMessage.TransportId =
" 0" ;
chatMessage.Recipients.Add (数字);
ChatMessageManager 。ShowComposeSmsMessageAsync(chatMessage);
最后我得到以下例外情况。
是否有任何解决方案可以为选择发送短信来自联系人选择器类的联系
Hi bandaru,
作为友情提醒,请务必根据
发布指南:主题行标记
因为我没有有你的代码,我已经在我这边创建了以下代码,它运行正常。根据警告信息,它似乎与位置相关,请尝试在您的代码中放置一个断点,看看我们是否可以从geoposition.Coordinate.Point.Position.Latitude获得
的正确结果和geoposition.Coordinate.Point.Position.Longitude:var contactPicker = new ContactPicker();
contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber);
联系contact = await contactPicker.PickContactAsync();
var chatMessage = new ChatMessage();
chatMessage.Body ="这是我当前的位置" + https://www.bing。 com / mapspreview /?q = + .....
chatMessage.TransportId =" 0" ;;
var phonestest = contact.Phones;
foreach(手机中的var phone)
{
string number = phone.Number;
chatMessage.Recipients.Add(number);
等待ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
}
最好的问候,
Amy Peng
Hi,
I am developing one location application in that I want to share my location through SMS for a selected contact. for getting the contact I am using contact picker here the problem is when I am selecting the contact its working perfectly and for sending the SMS I am getting the below exceptions and the code also following there
For sending the SMS I am write down the below code.
varchatMessage = newChatMessage();
chatMessage.Body = "Hi,this is my current location "+ "https://www.bing.com/mapspreview/?q="+ geoposition.Coordinate.Point.Position.Latitude.ToString("0.00") + ","+ geoposition.Coordinate.Point.Position.Longitude.ToString("0.00");
chatMessage.TransportId = "0";
chatMessage.Recipients.Add(number);
ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage);
and finally I am getting the below exceptions.
is there any solutions to send the SMS for a select contact from contact picker class
Hi bandaru,
Welcome to the Developing Universal Windows apps forum!
As a friendly reminder please make sure to add the appropriate tags to the title of your post as per Guide to posting: subject line tags
Since I do not have your code, I have created the following code in my side, it works fine. Based on the warining information, it seems that it is something related with the location, please try to put a breakpoint in your code to see if we can get the correct result from the geoposition.Coordinate.Point.Position.Latitude and geoposition.Coordinate.Point.Position.Longitude:
var contactPicker = new ContactPicker(); contactPicker.DesiredFieldsWithContactFieldType.Add(ContactFieldType.PhoneNumber); Contact contact = await contactPicker.PickContactAsync(); var chatMessage = new ChatMessage(); chatMessage.Body = "Hi,this is my current location "+ https://www.bing.com/mapspreview/?q=+..... chatMessage.TransportId = "0"; var phonestest = contact.Phones; foreach (var phone in phonestest) { string number = phone.Number; chatMessage.Recipients.Add(number); await ChatMessageManager.ShowComposeSmsMessageAsync(chatMessage); }
Best Regards,
Amy Peng
这篇关于[UWP] ChatMessage和ContactPicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!