Question

I made a program that uses Restsharp to communicate with a asp.net web api web service. All was fine in the simulator but the same code does not work on the actual iPhone. I am using the monotouch version of restsharp from here . When debugging in the simulator I used the simulator version of the library, and when debugging on the iphone I used the one for the iPhone. On the iPhone response.Data is null. (BTW is there an easy way to automatically use the iphone version of the library when debugging on iphone and the simulator version of the library when debugging on the simulator?)

var hh = client.ExecuteAsync<List<Accommodation>>(request, (response) => {
    //on the simulator this works, on the device response.Data is null
    if (response.StatusCode == HttpStatusCode.OK && response.Data != null)
        searchCompleteAction(response.Data);
    else
        searchCompleteAction(null);
        UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false;
});
Was it helpful?

Solution

Use this RestSharp library RestSharp from Xamarin Components

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top