Geolocation services in IOS are not generating signal ???



  • Hi

    I am trying this code in IOS, iphone 5 and I get the message Source Created but it appears that the signal for teh slot ( positionUpdate) is never generated: I do not get the the debuging comment "Position updated:" inside the slot.

    Is there anything else I need to do to get the location services working in IOS8

    Thank you

    class Location : public QObject
    {
    Q_OBJECT
    public:
    Location(QObject *parent = 0)
    : QObject(parent)
    {

          qDebug() << "Position created:";
         QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
    
         if (source) {
            
             connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
                     this, SLOT(positionUpdated(QGeoPositionInfo)));
    
              qDebug() << "Source created:";
    
             source->setUpdateInterval(1000);
             source->startUpdates();
         }
     }
    

    private slots:
    void positionUpdated(const QGeoPositionInfo &info)
    {

         qDebug() << "Position updated:" << info;
     
    
     }
    

    };



  • Hi

    a clear view of the code in previous msg

    @class Location : public QObject
    {
    Q_OBJECT
    public:
    Location(QObject *parent = 0)
    : QObject(parent)
    {

          qDebug() << "Position created:";
      
    
         if (source) {
             source->setPreferredPositioningMethods(QGeoPositionInfoSource::SatellitePositioningMethods);
             connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),
                     this, SLOT(positionUpdated(QGeoPositionInfo)));
              qDebug() << "Source created:";
             source->setUpdateInterval(1000);
             source->startUpdates();
    
         }
     }
    

    private slots:
    void positionUpdated(const QGeoPositionInfo &info)
    {

         qDebug() << "Position updated:" << info;
       
     }
    

    };
    @


Log in to reply
 

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