Solved QNetworkConfigurationManager on iphone ios events?
-
Can I expect events on the iphone to occur when the network config is changing or do I need to repeatedly call updateConfigurations() on the manager to have the latest situation?
I am testing it and when putting the phone to airplane mode and back, nothing is fired. I am checking :
- updateCompleted
- onlineStateChanged
- configurationChanged
- configurationAdded
- configurationRemoved
I want to know if the phone has an internet connection or not without polling the whole time (to save some battery life).
I am using Qt 5.9.2 on ios 11 with the latest xcode 9.0.
-
@MetalMajor onlineStateChanged isn't reliable on iOS.
see https://bugreports.qt.io/browse/QTBUG-56151
but there's an easy workaround: use iOS Reachability Class
see my blog:
https://appbus.wordpress.com/2017/06/23/issues-and-workarounds-update-qt-5-8-0-qt-5-9-0/ (scroll down)
this works very well - I'm using it in all my apps -
Thanks! I had something based on the same Reachability, but it was too complicated :) most probably because I don't know any objective c :p your solution is muuuch simpler!! thanks...
-
@MetalMajor great to hear :)