Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在ios中从google地图返回本机应用程序_Ios_Iphone_Google Maps - Fatal编程技术网

如何在ios中从google地图返回本机应用程序

如何在ios中从google地图返回本机应用程序,ios,iphone,google-maps,Ios,Iphone,Google Maps,我正在通过下面的代码从本机应用程序打开谷歌地图,现在我想从谷歌地图返回到ios本机应用程序。我如何才能做到这一点。提前谢谢 if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) { NSString *url=[NSString stringWithFormat:@"comgooglemaps-x-callback://?saddr=28.458125,

我正在通过下面的代码从本机应用程序打开谷歌地图,现在我想从谷歌地图返回到ios本机应用程序。我如何才能做到这一点。提前谢谢

    if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"comgooglemaps://"]]) {
 NSString *url=[NSString stringWithFormat:@"comgooglemaps-x-callback://?saddr=28.458125,77.033833&daddr=18.407000,73.506300&directionsmode=driving&x-success=sourceapp://?resume=true&x-source=lavasa"];
 [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

   }
在关于URL方案的部分中,有一个回调应该如何工作的示例

  • x-source
    发送x-callback请求的应用程序的名称。 短名称优先
  • x-success
    -完成后要调用的URL。 这通常是你自己应用程序的URL方案,允许用户 返回到原始应用程序
例如:

comgooglemaps-x-callback://?center=40.765819,-73.975866&zoom=14
   &x-success=sourceapp://?resume=true
   &x-source=SourceApp

在这里,您可以看到
x-success
属性,该属性应设置为您的应用程序URL方案,
x-source
是您的应用程序名称,如Google Maps应用程序返回到应用程序栏中所示。

谢谢,您可以编写一个lat long和应用程序名称的虚拟URL吗。这可以工作只要用你的应用程序详细信息替换
sourceapp
,这并不难。因为我无法访问你的应用程序,所以我无法让示例更清楚地表明它现在是。因为我的示例已经包含了一个虚拟URL。我使用了这个URL==comgooglemaps-x-callback://?saddr=28.458125,77.033833&daddr=18.407000,73.506300&directionsmode=driving&x-success=sourceapp://?resume=true&x-source=lavasa,但在谷歌地图中没有显示取消按钮,因为
sourceapp://?resume
不是你的应用程序URL方案。谷歌地图应用程序检查是否可以打开
x-success
url。非常感谢,我将url方案放在了plist中。现在一切都好了