How do I check to see if the user is connected to the internet, and if not, display a notification? I know how to display the notification just not how to trigger it if the connection is offline.
In short:
Set
on the configuration you use to create yourwaitsForConnectivity
.NSURLSession
Start your request at any time.
If there’s connectivity, the request will start immediately. If not, you’ll get a
delegate callback and you can adjust your UI accordingly.-URLSession:taskIsWaitingForConnectivity:
For more details, watch WWDC 2017 Session 709 Advances in Networking, Part 2, where we discuss this feature in some detail.
Share and Enjoy
—
Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
let myEmail = "eskimo" + "1" + "@apple.com"