If you do a reachability check to say Google, it really shouldn't take long
and can probably be done synchronously. The way I do it, when they click
submit, I validate the form data and check reachability, if any of that is
wrong, I throw up an alert. If not, I call my webservice async with a
callback method and throw up a loading animation. The callback method does
the work based on the response and when it's finished turns off the loading
animation. I can throw up some sample code if it'd be helpful.

I think it's best to just do a reachability check before you're going to
use the internet rather than doing it repeatedly throughout the app.

On Mon, Nov 7, 2011 at 2:10 AM, simarx <[email protected]> wrote:

>
> We have our own web-services on our own servers and use them all the time
> for all sorts of purposes and don't experience problems in using them so I
> know they're running fine.
>
> >From the iPhone I was regularly getting timeouts getting a connection. So
> steps I took to progress...
>
> 1. Using the Reachability classes - before every attempt to use my
> web-service, I created an instance of the Reachability class and did a
> IsHostReachable() check before calling my own methods. My application
> generally requires most flows to be done in a linear manner.
>
> 2. I was doing the IsHostReachable() check synchronously which meant that
> if
> the host was unreachable, ie. no internet connection, that check itself was
> taking a long time to return.
>
> 3. Next, I put the IsHostReachable() into it's own thread, but since I was
> still creating a new call to
> IsHostReachable() in the thread, the call was still potentially taking a
> long time to return.
>
> 4. Where I'm at now and hopefully the Reachability classes are doing the
> right thing, is creating a new Thread that exists throughout the
> application
> session, and use call-back type mechanism that maintains the status of the
> "reachability". Then before I use any of my web-services, I will just check
> the "reachability status" to determine if a net-connection exists rather
> than call IsHostReachable().
>
> Does this sound like a sensible approach?
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> My current code was using the Reachability classes to determine if an
> internet connection existed before making
>
> --
> View this message in context:
> http://monotouch.2284126.n4.nabble.com/Web-services-vs-other-tp3997150p3998074.html
> Sent from the MonoTouch mailing list archive at Nabble.com.
> _______________________________________________
> MonoTouch mailing list
> [email protected]
> http://lists.ximian.com/mailman/listinfo/monotouch
>
_______________________________________________
MonoTouch mailing list
[email protected]
http://lists.ximian.com/mailman/listinfo/monotouch

Reply via email to