iphone - CLLocation 和 double 的问题

标签 iphone ios objective-c double cllocation

我的经度为 -122.406417 并且 self.actualLongitude 是双重成员。

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] 新 alt: 0.000000

注意:正值是正确的。我正在使用模拟器。

最佳答案

在你的 3 个作业的最后一行:

self.actualLongitude = [self.tempLocation altitude];

你用 altitude 覆盖了 self.actualLongitude 的值(这发生了 为零)。

你可能是说

self.actualAltitude = [self.tempLocation altitude];

关于iphone - CLLocation 和 double 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14729712/

相关文章:

iphone - 关于 FoneMonkey

iphone - 使用 CSS 设置 UIWebView 样式时的图片路径

iphone - 通用应用程序工作流程

ios - xcode 3.1.1 创建 iPhone 应用程序(3,4,5)

objective-c - RestKit - 发布对象并更新其属性

objective-c - 如何在 Web 服务器上运行 Objective-C 二进制文件?

iphone - AppDelegate 中的 didSelectViewController 没有被调用

iphone - iPhone 上的线性代数(python/numpy?)

iphone - 未找到 Storyboard文件 'MainStoryboard_iPad~ipad.storyboardc'

ios - Cocoapods 没有集成到 Pod 文件中