我对于遇到的问题感到非常沮丧,因为缺乏信息。我无法找到任何有关我的问题的信息,我开始相信这是不可能的,我想做的事情。这是我的问题,并感谢您的阅读。从数据库信息启动应用程序的Apple URL Scheme
我想要我的ViewController上的按钮来打开存储在我的Sqlite数据库表中的经度和纬度坐标的Apple Maps。我已经能够通过添加一个MapView来成功地做到这一点。我想重现此功能,并让用户能够点击“获取路线”按钮,它将自动弹出Apple Maps应用程序,并自动设置结束地址。通过使用@“finishLat”和@“finishLng”,我可以收集数据库信息。这在使用Apple URL Scheme时可能吗?
这是Mapview用这些信息做的一个示例。我唯一需要的部分是@“finishLat”和@“finishLng”。我还需要使用“运行”功能以收集正确的地址。
[super viewDidLoad];
CGRect bounds = self.view.bounds;
mapview = [[MapView alloc] initWithFrame:CGRectMake(0, 0, bounds.size.width, bounds.size.height)];
[self.view addSubview:mapview];
NSArray *result = [_runs objectForKey:@"results"];
NSDictionary *arr = [result objectAtIndex:0];
arr = [arr objectForKey:@"run"];
NSMutableArray *arrPlaces = [[NSMutableArray alloc] init];
NSArray *arrDirvers = [arr objectForKey:@"drivers"];
for (int i =0; i < [arrDirvers count]; i++) {
NSDictionary *asdfg = [arrDirvers objectAtIndex:i];
Place *startPt = [[Place alloc] init];
Place *endPt = [[Place alloc] init];
NSString *temp = [asdfg objectForKey:@"startLat"];
startPt.latitude = [temp floatValue];
temp = [asdfg objectForKey:@"startLng"];
startPt.longitude = [temp floatValue];
startPt.name = [asdfg objectForKey:@"name"];
temp = [asdfg objectForKey:@"finishLat"];
endPt.latitude = [temp floatValue];
temp = [asdfg objectForKey:@"finishLng"];
endPt.longitude = [temp floatValue];
endPt.name = [asdfg objectForKey:@"name"];
[arrPlaces addObject:startPt];
[arrPlaces addObject:endPt];
这就是我所拥有的。
- (IBAction)GetDirections:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString: @"http://maps.apple.com/?q"]];
}