如何解决 xamarino.ios 中未处理的异常?
how to solve unhandled mamaged exception in xamarino.ios?
我是新手。请不要给我负声誉和阻止。我的问题是我在 xamarin.ios 中有一个按钮。我使用该按钮从 table 视图读取数据列表,并将值上传到 php 服务器。但是当我点击按钮时,我得到了超出范围的未处理的托管异常参数。我该如何解决这个问题。请高手帮我出出主意。
buton.TouchUpInside +=(s,e)=>{
String v=Vendor[0];
string url="my.something.com/ios_files.php?id=24&vendor="+v;
string myParam="";
using (WebClient client=new WebClient())
{
client.Headers[HttpRequestHeader.ContentType]="application/x-www-form-urlencoded";
String Result=client.UploadString(url,myParam);
Console.writeLine(Result);
}
如何解决?
您处理异常:
buton.TouchUpInside +=(s,e)=> {
try {
String v=Vendor[0];
string url="my.something.com/ios_files.php?id=24&vendor="+v;
string myParam="";
using (WebClient client=new WebClient())
{
client.Headers[HttpRequestHeader.ContentType]="application/x-www-form-urlencoded";
String Result=client.UploadString(url,myParam);
Console.writeLine(Result);
}
} catch (Exception ex) {
// do something useful, probably show an error message to the user
Console.WriteLine (ex);
}
}
我是新手。请不要给我负声誉和阻止。我的问题是我在 xamarin.ios 中有一个按钮。我使用该按钮从 table 视图读取数据列表,并将值上传到 php 服务器。但是当我点击按钮时,我得到了超出范围的未处理的托管异常参数。我该如何解决这个问题。请高手帮我出出主意。
buton.TouchUpInside +=(s,e)=>{
String v=Vendor[0];
string url="my.something.com/ios_files.php?id=24&vendor="+v;
string myParam="";
using (WebClient client=new WebClient())
{
client.Headers[HttpRequestHeader.ContentType]="application/x-www-form-urlencoded";
String Result=client.UploadString(url,myParam);
Console.writeLine(Result);
}
如何解决?
您处理异常:
buton.TouchUpInside +=(s,e)=> {
try {
String v=Vendor[0];
string url="my.something.com/ios_files.php?id=24&vendor="+v;
string myParam="";
using (WebClient client=new WebClient())
{
client.Headers[HttpRequestHeader.ContentType]="application/x-www-form-urlencoded";
String Result=client.UploadString(url,myParam);
Console.writeLine(Result);
}
} catch (Exception ex) {
// do something useful, probably show an error message to the user
Console.WriteLine (ex);
}
}