查看是否下载了另一个应用 Xcode Objective-C

See if another app is downloaded Xcode Objective-C

我正在向我的应用程序添加一些位置。我有它默认在 Apple 地图中打开这些位置。但我想在用户下载 Google 地图的情况下,他们可以选择在 Google 地图中打开它。那么如何在 Objective-c 中获取 Xcode 以查看用户是否在他们的 phone 上有 Google 地图?我过去的做法似乎不再奏效了。

这是我一直在使用的

-(IBAction)parkerMap {
{

    BOOL isAppInstalled=[[UIApplication sharedApplication] canOpenURL: [NSURL URLWithString:@"google.maps://"]];
    if(isAppInstalled)
    {
        UIAlertController* maps = [UIAlertController alertControllerWithTitle:@"" message:@"Would you like to open in Apple or Google Maps?"
                                                               preferredStyle:UIAlertControllerStyleAlert];

        UIAlertAction* appleAction = [UIAlertAction actionWithTitle:@"Apple" style:UIAlertActionStyleDefault
                                                         handler:^(UIAlertAction * action) {
                                                             [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://maps.apple.com/?address=68,D.L.WeatherlyLn.,38388"] options:@{} completionHandler:nil];
                                                         }];
        UIAlertAction* googleAction = [UIAlertAction actionWithTitle:@"Google" style:UIAlertActionStyleDefault
                                                          handler:^(UIAlertAction * action) {
                                                              [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.google.com/maps/place/68+D.L.+Weatherly+Ln,+Wildersville,+TN+38388/          @35.7776813,-88.3943264,17z/data=!3m1!4b1!4m5!3m4!1s0x887c717763333487:0x8ac40c35453bbb84!8m2!3d35.777677!4d-88.3921377"] options:@{} completionHandler:nil];
                                                          }];

        [maps addAction:appleAction];
        [maps addAction:googleAction];
        [self presentViewController:maps animated:YES completion:nil];
         }
    else
    {

       [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"http://maps.apple.com/?address=68,D.L.WeatherlyLn.,38388"] options:@{} completionHandler:nil];
    }

}
}

enter image description here

看这里

if ([[UIApplication sharedApplication] canOpenURL:
     [NSURL URLWithString:@"comgooglemaps://"]]) {
  [[UIApplication sharedApplication] openURL:
   [NSURL URLWithString:@"comgooglemaps://?center=40.765819,-73.975866&zoom=14&views=traffic"]];
} else {
  NSLog(@"Can't use comgooglemaps://");
}

https://developers.google.com/maps/documentation/urls/ios-urlscheme