以上的iOS 9.0
第1步:在LSApplicationQueriesSchemes添加comgooglemaps在您的应用程序的info.plist
第2步。
BOOL isGoogleMap = [[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"comgooglemaps://"]];
UIAlertView *alert;
if(isGoogleMap)
{
alert = [[UIAlertView alloc]
initWithTitle:@"Get Directions"
message:@"Show Map"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"View in Apple Maps", @"View in Google Maps", nil];
}
else
{
alert = [[UIAlertView alloc]
initWithTitle:@"Get Directions"
message:@"Show Map"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"View in Apple Maps", nil];
}
alert.tag = 1010;
[alert show];
酷,现在是有道理的 - 从来没有见过这样的:-) –
完美的作品 –
返回false和谷歌地图已经存在于iPhone 是有ios9任何其他的解决办法??? –