我是Xamarin的新手,如何为ios和android调用webservice 使用单个代码段。
答案 0 :(得分:0)
在发布新问题之前,请搜索现有的
consuming a php webservice in Xamarin PCL
重复!
BTW你可以使用httpClient
//Use this class as a singleton in an IoC container
class MyAppClient
{
readonly HttpClient _httpClient = new HttpClient();
public async Task<string> GetChuck()
{
return await _httpClient.Get("http://chucknorris.com");
}
}
//Although "using" is good in general, don't do this
using (var httpClient = new HttpClient())
{
return await _httpClient.Get("http://chucknorris.com");
}
取自http://jonathanpeppers.com/Blog/improving-http-performance-in-xamarin-applications
的代码示例