I am looking for a way to restrict my iOS app (or even a portion of it ) to wifi only. I’ve looked through the reachability example and haven’t really come up with a solution. I can get it to display a message when the user is connected to 3g, but I don’t know how to get it to stop loading the view.
I have a view that loads another view when a button is pressed. I want that second view to close if the device is connected to 3g. How can I go about doing this?
I’ve never done what you’re trying to do before, but I imagine it’s just a matter of figuring out the Reachability API.
I’d start out with some code in your AppDelegate class:
It’s a really simple piece of code. What you could do here is listen for changes in reachability status and then set up your app to react appropriately. You don’t necessarily have to do this in your AppDelegate class. It all depends on what you want to accomplish.