我在设备上尝试调试我的应用程序时遇到了一个奇怪的问题。
var url = "http://maps.googleapis.com/maps/api/geocode/xml?sensor=true&address=";
url += pin.Element("address").Value;
var address = XDocument.Load(url);
最后一行给了我这个错误:
System.Net.WebException: Error: NameResolutionFailure
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x00065] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:854
at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Developer/MonoTouch/Source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:860
...
但它仅在实际设备上。如果我在模拟器中运行它,它会完美运行。
最佳答案
NameResolutionFailure
表示 DNS 错误,可能是因为该设备无法访问互联网、未配置 DNS 或至少与您的 Mac(运行模拟器)正在使用。
您可以从您的设备访问互联网吗? (例如飞行模式)
如果是这样,您可以尝试在设备上从 Safari 访问 http://maps.googleapis.com
站点,看看您设备上配置的 DNS 服务器是否可以找到主机。
关于xamarin.ios - 单色触摸 : NameResolutionError when running on device,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13000131/