pei*_*rix 2 linq-to-xml xamarin.ios
尝试在设备上调试我的应用时,我遇到了一个奇怪的问题.
var url = "http://maps.googleapis.com/maps/api/geocode/xml?sensor=true&address=";
url += pin.Element("address").Value;
var address = XDocument.Load(url);
Run Code Online (Sandbox Code Playgroud)
最后一行给了我这个错误:
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
...
Run Code Online (Sandbox Code Playgroud)
但它只在实际设备上.如果我在模拟器中运行它,它可以很好地工作.
A NameResolutionFailure表示DNS错误,可能是因为设备没有互联网访问,没有配置DNS或至少与Mac(运行模拟器)正在使用的配置(例如Wifi,3G)不同.
您可以通过设备访问互联网吗?(例如飞机模式)
如果是这样,您可以尝试在设备上从Safari访问该http://maps.googleapis.com站点,以查看您设备上配置的DNS服务器是否可以找到该主机.
| 归档时间: |
|
| 查看次数: |
862 次 |
| 最近记录: |