Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Positioning not working in iOS
Forum Updated to NodeBB v4.3 + New Features

Qt Positioning not working in iOS

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
21 Posts 7 Posters 8.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kolegs
    wrote on last edited by kolegs
    #6

    I ask for the location at the begining of the program so it shows same time application starts.
    Btw I did not add anything to my Info.plist, so I am not sure if it is required

    1 Reply Last reply
    0
    • M Offline
      M Offline
      m_andrej
      wrote on last edited by
      #7

      I tried again with a Hello world application from scratch. It still doesn't work. I didn't write a particular info.plist, so it was autogenerated by qmake. Application starts normally, but I don't get any dialog asking for permission to provide location and of course positionUpdated() still isn't emitted.

      I tried both real device and iOS Simulator with simulated location.
      Any ideas what else I should try?

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kolegs
        wrote on last edited by kolegs
        #8

        Maybe try examples available, like: "Weather Info"?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          m_andrej
          wrote on last edited by
          #9

          Weather info doesn't work either. It just shows "Loading weather data" indefinitely.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #10

            What version of iOS and Xcode are you using ? (latest can change pretty quickly)

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply
            0
            • SGaistS SGaist

              What version of iOS and Xcode are you using ? (latest can change pretty quickly)

              M Offline
              M Offline
              m_andrej
              wrote on last edited by
              #11

              I have Xcode 7.1.1 and iOS 9.1 both on device and simulator. I added this information to the first post.

              I already verified that I can make a Hello World iOS app in XCode, which successfully obtains user position using native code (CLLocationManager).

              1 Reply Last reply
              0
              • L Offline
                L Offline
                ldanzinger
                wrote on last edited by
                #12

                You might need to add the following keys to your plist

                • NSLocationAlwaysUsageDescription
                • NSLocationWhenInUseUsageDescription

                You also may need to add either of the following to your project file

                QT += positioning sensors

                TavisT 1 Reply Last reply
                2
                • M Offline
                  M Offline
                  m_andrej
                  wrote on last edited by m_andrej
                  #13

                  I already implemented this using native code. But thanks. Maybe this helps somebody else.

                  BTW I used the class CLLocationManager-blocks (https://github.com/axldyb/CLLocationManager-blocks). Thanks to this I was able to implement it by a brief Objective-C snippet in a QObject subclass. The position-update-handler was just an objective-C Block rather than Delegate. Writing the Delegate would have required to subclass NSObject.

                  1 Reply Last reply
                  0
                  • L ldanzinger

                    You might need to add the following keys to your plist

                    • NSLocationAlwaysUsageDescription
                    • NSLocationWhenInUseUsageDescription

                    You also may need to add either of the following to your project file

                    QT += positioning sensors

                    TavisT Offline
                    TavisT Offline
                    Tavis
                    wrote on last edited by
                    #14

                    @ldanzinger All you need to do in order to get QTPositioning to work is add <key>NSLocationAlwaysUsageDescription</key>
                    to your info.plist file.

                    create an iOS folder in the root of your project and place your info.plist file in there then add the following to you .pro file

                    ios {
                    QMAKE_INFO_PLIST = ios/Info.plist
                    }

                    This fixes the geoflickr example qt quick app.

                    1 Reply Last reply
                    0
                    • B Offline
                      B Offline
                      beak
                      wrote on last edited by
                      #15

                      IOS10.2
                      work only simulator, on device not work

                      QGeoPositionInfoSource::createDefaultSource(0) is NULL
                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #16

                        Did you got asked for permission ?

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        B 1 Reply Last reply
                        1
                        • E Offline
                          E Offline
                          ealltech
                          wrote on last edited by
                          #17

                          I ask for the location at the begining of the program so it shows same time application starts.
                          Btw I did not add anything to my Info.plist, so I am not sure if it is required

                          1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Did you got asked for permission ?

                            B Offline
                            B Offline
                            beak
                            wrote on last edited by
                            #18

                            @SGaist
                            ask permision only simulator
                            on real device dont ask

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #19

                              Then check that you allowed the GPS to be used.

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              B 1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Then check that you allowed the GPS to be used.

                                B Offline
                                B Offline
                                beak
                                wrote on last edited by
                                #20

                                @SGaist where check?
                                in device Settings->Privacy->Location Service
                                there is no my application

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #21

                                  Then delete the application from your device and install it again. Do not just re-run your application, nuke it from the device before starting it again.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0

                                  • Login

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • Users
                                  • Groups
                                  • Search
                                  • Get Qt Extensions
                                  • Unsolved