我對於遇到的問題感到非常沮喪,因爲缺乏信息。我無法找到任何有關我的問題的信息,我開始相信這是不可能的,我想做的事情。這是我的問題,並感謝您的閱讀。從數據庫信息啓動應用程序的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"]];
}