【发布时间】:2009-11-02 06:56:08
【问题描述】:
我是 iPhone 开发的新手,我一直在努力研究如何将 GPS 信息包含到我正在开发的应用程序中。 我已经完成了 HelloThere 教程,这是一个很好的开始
http://www.mobileorchard.com/hello-there-a-corelocation-tutorial/
在我的 iPhone 上运行它没有任何问题。然后我举了这个例子,并且一直试图将 GPS 信息整合到一个更大、更复杂的应用程序中。较大的应用程序有一个现有的函数,它将向服务器发送一个发布请求,我想简单地提供位置数据,特别是这个函数的坐标.纬度和坐标.经度,如果可能的话而不改变它。
这在我使用过的其他语言中非常简单,但在 Objective C 中却被证明是相当具有挑战性的。
基本上,按照教程,我已经到了记录位置信息的地步,
//GPS stuff
- (void)locationUpdate:(CLLocation *)location {
//locationLabel.text = [location description];
locationString = [location description];
locationLabel.text = locationString;
locLat = [NSString stringWithFormat:@"%lf", location.coordinate.latitude];
locLong = [NSString stringWithFormat:@"%lf", location.coordinate.longitude];
}
但我不知道如何才能使 locLat 和 locLong 变量可用于应用程序的其他部分。很蹩脚,但我还是有点迷失了目标C。
【问题讨论】:
标签: iphone objective-c