diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-04-17 22:50:33 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-04-17 22:59:19 -0700 |
commit | 4ac6f34b16aa404b8753d2ae1103da3605f33886 (patch) | |
tree | 99108554a5f5e70be2e95b68e463d85a7b471029 /core/gpslocation.cpp | |
parent | c0b44e25b730ffb839b019fa9e84a75a1b14aa12 (diff) | |
download | subsurface-4ac6f34b16aa404b8753d2ae1103da3605f33886.tar.gz |
With patched Qt 5.6 for iOS correctly handle disabled GPS source
Qt 5.6.0 is broken when it comes to using CoreLocationService on iOS.
It doesn't even check if the location service is enabled. My patches fix
that and make Qt set an error code right after service creation. Having
the service creation fail is actually the wrong thing to do because then
Qt switches over to GeoClue and that really isn't helpful for our needs
here.
Additionally, Qt 5.6.0 without my patches doesn't follow the REQUIRED
flow of using the location service as it does not check the access
permissions before accessing the GPS service - without doing so the
GPS service will not run in the background.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/gpslocation.cpp')
-rw-r--r-- | core/gpslocation.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp index 29a8827af..2a097588a 100644 --- a/core/gpslocation.cpp +++ b/core/gpslocation.cpp @@ -58,6 +58,19 @@ QGeoPositionInfoSource *GpsLocation::getGpsSource() if (!m_GpsSource) { m_GpsSource = QGeoPositionInfoSource::createDefaultSource(this); if (m_GpsSource != 0) { +#if defined(Q_OS_IOS) + // at least Qt 5.6.0 isn't doing things right on iOS - it MUST check for permission before + // accessing the position source + // I have a hacked version of Qt 5.6.0 that I will build the iOS binaries with for now; + // this test below righ after creating the source checks if the location service is disabled + // and set's an error right when the position source is created to indicate this + if (m_GpsSource->error() == QGeoPositionInfoSource::AccessError) { + haveSource = NOGPS; + emit haveSourceChanged(); + m_GpsSource = NULL; + return NULL; + } +#endif haveSource = (m_GpsSource->supportedPositioningMethods() & QGeoPositionInfoSource::SatellitePositioningMethods) ? HAVEGPS : NOGPS; emit haveSourceChanged(); #ifndef SUBSURFACE_MOBILE |