Hi, I really would appreciate if anybody can help me with this... I searched this forum and Google already with no success.
I am trying to get positioning info in iOS using Qt. Have tried the simulator as well as a real iPhone. I get at source from QGeoPositionInfoSource that says "corelocation", but source does not seem to emit a signal since positionUpdated never gets called. Getting the error from source returns 2 "An unidentified error occurred." Any ideas?
Here is my code:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
if (source){
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),this, SLOT(positionUpdated(QGeoPositionInfo)));
source->setUpdateInterval(100);
source->startUpdates();
qDebug()<<"Source found";
qDebug()<<source->availableSources();
}else{
qDebug()<<"Failed source";
}
}
void MainWindow::positionUpdated(const QGeoPositionInfo &info)
{
qDebug() << "Position updated:" << info;
}
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QGeoPositionInfoSource *source = QGeoPositionInfoSource::createDefaultSource(this);
if (source){
connect(source, SIGNAL(positionUpdated(QGeoPositionInfo)),this, SLOT(positionUpdated(QGeoPositionInfo)));
source->setUpdateInterval(100);
source->startUpdates();
qDebug()<<"Source found";
qDebug()<<source->availableSources();
}else{
qDebug()<<"Failed source";
}
}
void MainWindow::positionUpdated(const QGeoPositionInfo &info)
{
qDebug() << "Position updated:" << info;
}
To copy to clipboard, switch view to plain text mode
Bookmarks