我在约旦的亚喀巴,我的别针是佩特拉,我想要做的就是设置方向来自"我的位置"在约旦的亚喀巴(或约旦的任何地方)到约旦的佩特拉,坐标为30.322098,35.451790 ..它不起作用。
(方向是一个转到地图应用程序的按钮)
在iPhone上,当我选择"当前位置":方向无可用时,它会给我这个错误。
在iPhone上,它" Dropped Pin"它选择了一个我在约旦没有设置的别针。
在模拟器上,当我点击路线"当前位置不可用"
时,它会给我这个错误ViewController.m
#import "ViewController.h"
#import "CHDIRNSObject.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize CHDirectionMapView;
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
MKCoordinateRegion CHRegion = { {0.0, 0.0}, {0.0, 0.0} };
CHRegion.center.latitude = 30.322098;
CHRegion.center.longitude = 35.451790;
CHRegion.span.latitudeDelta = 5.00f;
CHRegion.span.longitudeDelta = 5.00f;
[CHDirectionMapView setRegion:CHRegion animated:YES];
CHDIRNSObject *CHann = [[CHDIRNSObject alloc] init];
CHann.title = @"Petra";
CHann.subtitle = @"Petra";
CHann.coordinate = CHRegion.center;
[CHDirectionMapView addAnnotation:CHann];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(IBAction)CHDirection:(id)sender {
switch (((UISegmentedControl *) sender).selectedSegmentIndex) {
case 0:
CHDirectionMapView.mapType = MKMapTypeStandard;
break;
case 1:
CHDirectionMapView.mapType = MKMapTypeHybrid;
break;
default:
break;
}
}
-(IBAction)CHGetLocation:(id)sender {
CHDirectionMapView.showsUserLocation = YES;
}
-(IBAction)CHDirect:(id)sender {
NSString *urlString = @"http://maps.apple.com/maps?daddr=30.322098,35.451790";
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}
@end
帮助:)