我一直在尝试添加指向 Google 地图的链接,以便我可以显示一些到某个位置的路线。我遇到的唯一问题是代码无法识别该方法。以下是示例,希望对您有所帮助。
。H:
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
@interface More : UIViewController{
}
- (IBAction)directions:(id)sender;
-(CLLocationCoordinate2D)getCurrentLocation;
@end
米:
- (IBAction)directions:(id)sender {
CLLocationCoordinate2D currentLocation = [self getCurrentLocation];
NSString* address = @"********";
NSString* url = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%@",
currentLocation.latitude, currentLocation.longitude,
[address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
[[UIApplication sharedApplication] openURL: [NSURL URLWithString:url]];
}
错误: 找不到“getCurrentLocation”的方法定义
谢谢