[SOLVED] QGeoCoordinate returns Nan in iOS
-
Hi , I use qt 5.3.2 on mac to implement an application for iOS. I want to get user current location. My code is here:
@
source = QGeoPositionInfoSource::createDefaultSource(this);
if (source){
text->append("sourceName: " + source->sourceName()); //return: core location
source->setPreferredPositioningMethods(QGeoPositionInfoSource::AllPositioningMethods);
source->setUpdateInterval(10000);
}QGeoPositionInfo info = source->lastKnownPosition(); QGeoCoordinate coordinate = info.coordinate(); latitude = QString::number(coordinate.latitude()); longitude = QString::number(coordinate.longitude());
@
The code works for android but in iOS(iPhone 4s) latitude and longitude are nan.
in .pro file, i added:
@
QT +=positioning
LIBS += -framework CoreLocation
@
What's wrong in my code? please help me.