How to launch another app from an iPhone app

后端 未结 3 2143
独厮守ぢ
独厮守ぢ 2020-12-31 15:19

I am working on a map application in my iPhone app.

I have a button go.

When the user clicks this button in this method I want to check if user

3条回答
  •  感情败类
    2020-12-31 15:56

    Note that on iOS you can also navigate to Google Maps -- and pass along the query string or geopoint. Here's one example of navigating to a specific geopoint:

    if (self.mapView.userLocation.location) {
        NSString *urlAsString = [NSString stringWithFormat:@"comgooglemaps://?q=%f,%f", self.mapView.userLocation.location.coordinate.latitude, self.mapView.userLocation.location.coordinate.longitude];
        if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlAsString]]) {
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlAsString]];
        }
    } 
    

    Just a suggestion to enhance the user experience.

提交回复
热议问题