0
我有一个启动谷歌地图应用程序的应用程序。代码是:CoreLocation当前位置
UIApplication *app = [UIApplication sharedApplication];
[app openURL:[[NSURL alloc] initWithString: @"http://maps.google.com/maps?daddr=Obere+Laube,+Konstanz,+Germany&saddr="]];
saddr =应该是当前位置。我得到的当前位置与
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
NSLog(@"%f,%f", [newLocation coordinate]);
日志显示正确的坐标一样
2010-04-05 15:33:25.436 deBordeaux[60657:207] 37.331689,-122.030731
我没有找到传送坐标到URL字符串的正确途径。有人可以给我一个提示吗?
嗯,我在我的.h
入口在我的方法我用“newLocation”,而不是你的“位置”。的代码是:
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation {
NSLog(@"%f,%f", [newLocation coordinate]);
NSLog(@"%f", [newLocation coordinate].latitude);
storedLocation = [newLocation coordinate];
NSLog(@"Standort neu String: %@", storedLocation);
作为结果获得:
- 2010-04-05 20:28:44.397 deBordeaux [64179:207] 37.331689,-122.030731
- 2010-04-05 20:28:44.398 deBordeaux [64179:207] 37.331689
- 编程接收信号:“EXC_BAD_ACCESS”。
感谢您的快速答复。我了解“ll =”的用法,而不是“saddr =”。我的问题是,UIApplication ....的代码位于 - (IBAction)nav ...中,后面的位置坐标位于#pragma标记CLLocationManagerDelegate中。我找不到在NSString中“存储”位置坐标的方法。 – Christian 2010-04-05 17:45:52