[SOLVED] GPS location fix working on Android but not iOS



  • QT 5.4 c++

    Compiled app OK and all running on iPad. What is strange is that it doesn't ask is it ok to use location information etc.

    When calling

    @QGeoPositionInfoSource* source = QGeoPositionInfoSource::createDefaultSource(this);@

    It gives a valid pointer.

    This all runs well with the same code on Android. I get regular position updates.



  • Taken from the documentation for

    @QGeoPositionInfoSource::​startUpdates()@

    Adding the key in Info.plist got it all working. Hope this is of help to someone.

    On iOS, starting from version 8, Core Location framework requires additional entries in the application's Info.plist with keys NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription and a string to be displayed in the authorization prompt. The key NSLocationWhenInUseUsageDescription is used when requesting permission to use location services while the app is in the foreground. The key NSLocationAlwaysUsageDescription is used when requesting permission to use location services whenever the app is running (both the foreground and the background). If both entries are defined, NSLocationWhenInUseUsageDescription has a priority in the foreground mode.



  • Hi,

    i am facing the same issue.
    Where do i find this key? and where do i find Info.plist?

    Thank you,

    Michael


  • Lifetime Qt Champion

    Hi,

    You have to create your own if the default one doesn't suite your needs.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.