views:

4854

answers:

4

Hello everybody,

my app accesses the internet and i just want to detect whether there is a connection either via wifi or via carrier data network or not

apple has made an example for that "Reachability"

https://developer.apple.com/iphone/library/samplecode/Reachability/

i think it just detects the wifi and not the carrier network

can anyone tell me, whats the best to be done to detect if there's a connection ( any type of connection )

Appreciate ur help!

+4  A: 

That sample is exactly what you need.

Look at Reachability.m. it'll tell you whether you have any connection, and then tell you what kind of connection you have.

Oren Mazor
To address your question more specifically: the Reachability code will detect *any* kind of connection, not just WiFi. All you have to do is import the Reachability classes into your project, then instantiate a Reachability object and go from there.
Tim
+2  A: 

The Reachability example may be overkill if you just want to detect whether or not you are connected, and what type of connection you are using if you are connected. Indeed the example also contains code showing how to setup and use callbacks that notify you of state changes.

For a snippet of source code telling you exactly if you are connected or not, and what type of connection you are using, you may want to take a look at my answer to a similar question, posted here.

unforgiven
A: 

Hi,

I have developed one application which is run very good in Wifi. But when I try to use it in carrier Network signal, it's not runnung.

I am very new to iPhone and I want to know that is there any code level chamge to make my application work or I need to do Network setting??

Please guide me.

Waiting for reply...

Thank You

Consider asking this in a separate question.Also,people can only help you if you actually provide the code that you feel isn't working the way it should.
David Schiefer
A: 

once you make a request to any web resource, the iPhone uses any connection it finds, it uses wifi ( as a higher priority ), and if wifi is not connected it uses carrier network. there's no code settings thats preventing carrier network.

all you have to do:

-Check the signal at the testing place. -check the link you are trying to reach on safari, to make sure its not your app that have the problem. -contact your carrier support if the link is not working on safari ( for sure using the carrier network )

zanque
this answer is for iampathik
zanque