Checking the network status
Any time you create an iOS application that communicates to other devices over the Internet, you will eventually need to verify that you have a connection prior to making your network calls. This can be done pretty easily by verifying that the address we are trying to connect is reachable, but only lets you know if you have a network connection or not.
When you write applications that communicate with mobile devices over the Internet, one of the things you need to keep in mind is that your users probably have a data plan that limits the amount of data they can send in a month. If they exceed that limit, they may have to pay an extra fee. If your application sends large amounts of data, it would be good to know what type of network connection the user currently has; if it is a mobile connection (as opposed to a Wi-Fi connection), warn the user prior to sending the data.
This recipe will check the type of network connection our device has. For this project, we will...