简体   繁体   中英

Open default map in ios

I have to open link into default map app in ios? otherwise first check google map present or not ,if yes then open link into google map otherwise in default browser of ios?

Have you tried Custom URL Scheme to achieve this? As per the documentation, you can set Native app URL string to call Maps from your app. Something like the below:

-(IBAction)mapLinkTapped:(id)sender {

    NSString *mapURL = @"http://maps.apple.com/?q=cupertino";
    NSURL *url = [NSURL URLWithString:mapURL];
    [[UIApplication sharedApplication] openURL:url];

}

This opens the default Maps app on your device. If that isn't available, then this goes into a browser and opens the map.

For more info on passing parameters, please refer this documention .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM