Select to view content in your preferred language

System.isOnline does not work in iOS 9

3441
9
Jump to solution
01-12-2016 08:55 AM
AndyWright
Frequent Contributor

It appears that the System.isOnline call from the QML Extras API does not work on iPad's with iOS 9.  We periodically call that to check for an active internet connection and react accordingly in our app when our users are no longer connected.  On our iOS 9 iPad, the device thinks it's always connected even when we shut down WiFi and cellular access. 

Has anyone else seen this, and if so are there any workarounds available?  We're using Qt 5.4.1 and the 10.2.6 API.

0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

For anyone else running into this, it seems to be an issue with Qt's underlying QNetworkConfigurationManager class and some VPN software on Andy's devices. It seems that the isOnline functionality that comes from this class may detect if there is an online connection, but is not able to determine if you have authenticated and can actually use the internet. For example, if you were in a hotel connected to the guest network, but have not yet provided your credentials. I created a standalone test app that just calls the C++ class without any ArcGIS APIs around it, and the issue still happens, so it has been logged with Qt [QTBUG-50518] QNetworkConfigurationManager isOnline not returning correct value - Qt Bug Tracker

Here is all that is really happening under the hood:

m_networkConfig = new QNetworkConfigurationManager(this);
m_networkConfig->isOnline();

-Luke

View solution in original post

9 Replies
LucasDanzinger
Esri Frequent Contributor

Hmm, I haven't gotten to test this, but I wonder if it would happen with Qt 5.5.1? 5.4.1 came out before iOS 9, so maybe there is some missing link here. Also, I wonder what version of Xcode you are using.

-Luke

0 Kudos
AndyWright
Frequent Contributor

Here's the answer I got from our iOS guy.    Turns out he is already using 5.5.1.

"We are using Xcode 6.4 and we cannot use Xcode 7 which is the release that came out for iOS 9 because QT doesn’t support it yet. We are already using QT 5.5.1."

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Sounds like it is probably a bug with Qt then. Our Extras library is just a straight wrap up of several Qt C++ classes. In the case of System.isOnline, it is just QNetworkConfigurationManager's isOnline check being wrapped and exposed as a Q_PROPERTY for use in QML. QNetworkConfigurationManager Class | Qt Network 5.5

-Luke

0 Kudos
AndyWright
Frequent Contributor

Yeh I figured as much.  This puts us in quite a pickle.  Are you guys able to repro this on your side?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

It seems to work alright for me. Here's my versions of everything:

Qt 5.5

Xcode 6.4

ArcGIS Runtime SDK 10.2.6

iOS 9.1

Here is my code. As I turn airplane mode on and off, then I click the button, I see the text updated. Do you see this?

import QtQuick 2.3
import QtQuick.Controls 1.2
import ArcGIS.Extras 1.0


ApplicationWindow {
    id: appWindow
    width: 800
    height: 600


    Text {
        id: text
    }


    Button {
        anchors.centerIn: parent
        onClicked: {
            text.text = "online? " + System.isOnline
        }
    }
}





0 Kudos
JamesStreet1
Emerging Contributor

Lucas

Just built your app and deployed it to an IPad. It does not work for me. I also ran it in OSX and it does not work there either. I checked my iPad and it is actually 9.2 but the fact that it doesn't work on my mac either is a little strange.

Any Ideas?

James

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Weird... I'm stumped. Did you give it a few seconds after you switched from airplane mode? I noticed I had to click the button a few times, because it would take a few seconds for the system to register that it was online/offline. Does it work on a windows machine, or some other OS for you?

0 Kudos
JamesStreet1
Emerging Contributor

Hi Lucas

I did some more testing and I think it may be something to do with a cellular enabled iOS device. On an iPad regardless of whether I have cellular data switched off and wifi off or airplane mode it still returns true (Even waiting a while).

On an IPhone 6 it returns false in airplane mode but still returns true when cellular data is off and wifi is off.

0 Kudos
LucasDanzinger
Esri Frequent Contributor

For anyone else running into this, it seems to be an issue with Qt's underlying QNetworkConfigurationManager class and some VPN software on Andy's devices. It seems that the isOnline functionality that comes from this class may detect if there is an online connection, but is not able to determine if you have authenticated and can actually use the internet. For example, if you were in a hotel connected to the guest network, but have not yet provided your credentials. I created a standalone test app that just calls the C++ class without any ArcGIS APIs around it, and the issue still happens, so it has been logged with Qt [QTBUG-50518] QNetworkConfigurationManager isOnline not returning correct value - Qt Bug Tracker

Here is all that is really happening under the hood:

m_networkConfig = new QNetworkConfigurationManager(this);
m_networkConfig->isOnline();

-Luke