Objective c 使用地图和标记销打开位置
我想用修改过的标记和详细信息打开纬度和经度值。因此,我需要检查是否安装了谷歌地图应用程序,我需要打开它,否则我将导航到苹果地图 在这里,我无法使用以下代码添加自定义pinObjective c 使用地图和标记销打开位置,objective-c,google-maps,mapkit,xcode7,ios9.1,Objective C,Google Maps,Mapkit,Xcode7,Ios9.1,我想用修改过的标记和详细信息打开纬度和经度值。因此,我需要检查是否安装了谷歌地图应用程序,我需要打开它,否则我将导航到苹果地图 在这里,我无法使用以下代码添加自定义pin NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"maps.apple.com/?z=12&q=%f,%f",[latitude floatValue],[longitude floatValue]]]; if
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"maps.apple.com/?z=12&q=%f,%f",[latitude floatValue],[longitude floatValue]]];
if (![[UIApplication sharedApplication] canOpenURL:url]) {
NSLog(@"Google Maps app is not installed");
//left as an exercise for the reader: open the Google Maps mobile website instead!
MKPlacemark *placemark = [[MKPlacemark alloc] initWithCoordinate:rdOfficeLocation addressDictionary:nil];
MKMapItem *item = [[MKMapItem alloc] initWithPlacemark:placemark];
item.name = [NSString stringWithFormat:@"%@",[[mDataArray1 objectAtIndex:indexPath.row] valueForKey:@"NAME"]];
item.phoneNumber = [NSString stringWithFormat:@"%@",[[mDataArray1 objectAtIndex:indexPath.row] valueForKey:@"DESTINATION"]];
[item openInMapsWithLaunchOptions:nil];
} else {
[[UIApplication sharedApplication] openURL:url];
}
因此,请帮助我为apple和google地图添加自定义pin值。您可以查看如何在官方文档中添加。但是,这只适用于谷歌地图,而不适用于苹果地图(在这种情况下,您需要为其提供不同的库)您可以查看如何在官方文档中添加。但是,这只适用于谷歌地图,而不适用于苹果地图(在这种情况下,您需要一个不同的库)