I want to close my app when an Internet connection is not available.
I check that, but how can I create an alert, and then close my app?
Your app should never close itself. iOS does not have the concept of quitting an app. You can inform the user that there is no internet connectivity and present a waiting screen or something else that shows them that your app is useless until the internet connection is available, but your app should continue running until the OS decides to shut you down.