GPSを使ったアプリを書いています。緯度、経度、その他のプロパティを正常に取得できますが、高度は常に「0.00」を返すようです。最も簡単な方法でテストするための次のコードがありますが、それでも0.00を取得します。以下のコード:
-(void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
// Stop updating location if renewed in less than 60 seconds
if ([self timeBetweenLocationandNow] < 60)
{
[locationManager stopUpdatingLocation];
NSLog(@"GPS Stopped");
}
NSLog(@"Altitude:%.2f m",newLocation.altitude);
}
何が間違っている可能性があるかについてのアイデアはありますか?また、initメソッドでは、次のようになります。
- (id)init
{
self = [super init];
if (self != nil)
{
// Create location manager Object
locationManager = [[CLLocationManager alloc] init];
// Set the delegate to this object
[locationManager setDelegate:self];
// Set distance filter and accuracy
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[locationManager startUpdatingLocation];
}
return self;
}
洞察に感謝します。ありがとうございました