0

We're new to IOS programming. We have a simple app that builds a table view using JSON data collected from an API we made. When there is no network connection, the app crashes of course, because all the UITableViewController delegate methods are working with an empty array.

Is there a simple method provided, that we can use to prevent the app from launching without a network connection, and present some nice alert to the user about this issue?

1 Answers1

0

You can use Reachability to detect if a connection is available, and to be notified when a connection becomes available. When no connection is there, you could show an alert and prevent your user from displaying your table view.

The github project read me will provide a full example of use.

PS: if your app crashes when launched when no connection is available, it will be rejected.

sergio
  • 67,961
  • 11
  • 98
  • 119