2013-02-06 39 views
1

我有一個經度-122.406417和self.actualLongitude是雙成員。問題與CLLocation和雙重

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年2月6日14:19:59.386 GeoCatching [4733:C07]原始經度:-122.406417
2013年2月6日14:19:59.386 GeoCatching [4733:C07]原始緯度:37.785834
2013-02-06 14:19:59.387 GeoCatching [4733:c07]原始替換:0.000000
2013-02-06 14:19:59.387 GeoCatching [4733:c07] new lon:0.000000
2013-02-06 14 :19:59.387 GeoCatching [4733:C07]新緯度:37.785834
2013年2月6日14:19:59.388 GeoCatching [4733:C07]新ALT:0.000000

注意:正值是正確的。我正在使用模擬器。

+0

你肯定self.tempLocation被兩次返回同樣的事情?你是否已經實現了自己的setter或getter for self.actualLongitude? –

+0

什麼是self.actualLongitude的類型? – occulus

+0

是的,getter和setter是爲self.actualLongitude實現的。 Self.actualLongitude是雙倍的。我在緯度和高度上也是這樣。就像我說的,只有負面的不正確在我的成員。 – Retterdesdialogs

回答

2

在你3所分配的最後一行:

self.actualLongitude = [self.tempLocation altitude]; 

您覆蓋的self.actualLongitude高度(這恰好 爲零)的值。

你大概的意思

self.actualAltitude = [self.tempLocation altitude]; 
+0

omg ...我檢查了三次。你是對的......該死的 – Retterdesdialogs