百度uri 跳转

-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{

    //1。获取应用程序对象
    UIApplication *app = [UIApplication sharedApplication];
    //2.获取url
    NSString *str = [NSString stringWithFormat:@"baidumap://map/geocoder?location=39.990912172420714,116.32715863448607&coord_type=gcj02&src=cn.beidou.ios"];
    NSURL *url = [NSURL URLWithString:str];
    //3.看是否能打开
    if ([app openURL:url])
    {
        //3.1能打开
        [app openURL:url];

    }
   else
   {
       //3.2打不开 去appstore下载
       NSLog(@"cannot open url go fuck youself!");
   }}

你可能感兴趣的:(iOS)