PDA

View Full Version : iOS Geolocation problem



TheJCR
14th November 2015, 20:27
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) :
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;
}

TheJCR
15th November 2015, 18:53
After a lot of effort i managed to solve the problem. You have to manually edit info.plist in xcode or a text editor. See the info in this post!

http://stackoverflow.com/questions/24062509/location-services-not-working-in-ios-8