Wednesday, 10 June 2015

Check for internet connection availability / Reachability in Swift




http://ios-blog.co.uk/tutorials/check-if-active-internet-connection-exists-on-ios-device/

https://github.com/Isuru-Nanayakkara/IJReachability/blob/master/IJReachability/IJReachability/IJReachability.swift

http://stackoverflow.com/questions/25398664/check-for-internet-connection-availability-in-swift


My solution is better https://github.com/wangpingsx/Reachability.swift which forked from ashleymills/Reachability.swift

I have fixed issues:

1>. Notify reachability when the library starts to work.
The issue I am trying to solve is that users should get the notification if they open the app without network connected.
2>. Fixed the issue that in case of using HostName, if no network before the library start, it will not send any notifications when the network is back.
3>. Fix double notification issue.
Dispatch_async will create a new thread to do the job for sending
notification and changing the status. This thread may be slower than
the main thread. So the main thread may dispatch the asynchronise event
several times before the status is changed.



No comments:

Post a comment