Check Internet Connection When User Interacts
Where I should implement a function to check internet connection on user's iPhone every time? Exactly:
- when some
- when user goes to home screen and returns to app via multitasking
I have a lot of
.swift files and I don't want to implement code in every
viewWillApear function of every
.swift file. Maybe there is some native place somewhere in AppDelegate or else?
Where I should implement a function to check internet connection on user's iPhone every time?
You shouldn't. The way to ask if the network is working is simply to try to use the network. You just attempt to do your networking and either you succeed or you fail in good order, and you take it from there. Most networking is done with URLSession, which will handle this gracefully for you, and in iOS 11 can even be configured to try again later automatically (
waitsForConnectivity). Please watch the relevant WWDC 2017 video for further discussion.
- → Function Undefined in Axios promise
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Click to navigate on mobile devices
- → Playing Video - Server is not correctly configured - 12939
- → How to allow api access to android or ios app only(laravel)?
- → Axios array map callback
- → Access the Camera and CameraRoll on Android using React Native?
- → Update React [Native] View on Day Change
- → Shopify iOS SDK - issue converting BuyProductVariant to BuyProduct
- → BigCommerce and shopify API
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → React Native - Differences between Android and IOS
- → What is the difference between React Native and React?