Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 05-03-2010, 10:50 AM   #34 (permalink)
rhawkey
Registered Member
 
Join Date: May 2009
Location: Canada
Posts: 23
rhawkey is on a distinguished road
Default

Quote:
Originally Posted by Peewee View Post
I have a little question about how to check for false positive.

When i e.g have my iphone connected to a wifi hotspot which demands that i need to type in a username and password before i can connect to the internet, I still get the flags that says that i`m connected to wifi.

What I am asking is this, when a phone is connected to a router but the router aint connected to the internet, i need the program to then say that i`m not connected to the internet. How can you archieve that with the use of the reachability code?
That's the host part of the reachability class. You can check not only whether the device is connected to a network but also whether a host is reachable. So if you check whatever your end target is that you're trying to connect to then you know the router is online. The remoteHostStatus method is what you're looking for.

By the way be careful where you put these tests. I've had some apps crash from timeouts on launch by having them in the startup code for my app. In the end I moved all of my reachability testing to a thread which sets a flag that I later poll from the main thread. Not only the network device connection test but also the host test can take a really long time and trigger the iPhone OS watchdog to kill your app if it's on the main thread.
rhawkey is offline   Reply With Quote
 

» Advertisements
» Online Users: 373
19 members and 354 guests
Absentia, alexP, Bobarino, Domele, Duncan C, Farfalo, flamingliquid, Garros1990, hacker073, ilmman, jbro, mongmo, n00b, Newbie123, NSString, pinky, Sami Gh, SillyHoney, SuperDietGenius
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,560
Threads: 94,079
Posts: 402,743
Top Poster: BrianSlick (7,990)
Welcome to our newest member, mongmo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:44 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.