1

-122.406417 の経度があり、self.actualLongitude は double メンバーです。

NSLog(@"original lon: %f",  [self.tempLocation coordinate].longitude);
NSLog(@"original lat: %f",  [self.tempLocation coordinate].latitude);
NSLog(@"original alt: %f",  [self.tempLocation altitude]);

self.actualLongitude = [self.tempLocation coordinate].longitude;
self.actualLatitude = [self.tempLocation coordinate].latitude;
self.actualLongitude = [self.tempLocation altitude];

NSLog(@"new lon: %f",  self.actualLongitude);
NSLog(@"new lat: %f",  self.actualLatitude);
NSLog(@"new alt: %f",  self.actualAltitude);

では、なぜ self.actualLongitude は 0.000000 なのでしょうか?

2013-02-06 14:19:59.386 GeoCatching[4733:c07] 元の経度: -122.406417
2013-02-06 14:19:59.386 GeoCatching[4733:c07] 元の緯度: 37.785834
2013-02-06 14:19: 59.387 GeoCatching[4733:c07] 元の alt: 0.000000
2013-02-06 14:19:59.387 GeoCatching[4733:c07] 新しい経度: 0.000000
2013-02-06 14:19:59.387 GeoCatching[4733:c07] 新しい緯度: 37.785834
2013-02-06 14:19:59.388 GeoCatching[4733:c07] 新しい代替: 0.000000

注: 正の値が正しいです。シミュレーターを使用しています。

4

1 に答える 1

2

3 つの課題の最後の行で:

self.actualLongitude = [self.tempLocation altitude];

self.actualLongitudeの値を高度で上書きします(たまたまゼロになります)。

あなたはおそらく意味します

self.actualAltitude = [self.tempLocation altitude];
于 2013-02-06T13:29:19.230 に答える