繁体   English   中英

Google Direction API在iOS中返回错误

[英]Google Direction API returns error in iOS

我正在使用以下谷歌方向网址

https://maps.googleapis.com/maps/api/directions/json?origin=12.976600,77.599300&destination=12.991491,77.715347&client=gme-company&signature=Fwelfejfcb4bbb3hj5bb=

它没有给出任何结果

在浏览器中显示

Unable to authenticate the request. Provided 'signature' is not valid for the provided client ID, or the provided 'client' is not valid.
The signature was checked against the URL: /maps/api/directions/json?origin=12.976600,77.599300&destination=12.991491,77.715347&client=gme-company
If this does not match the URL you requested, please ensure that your request is URL encoded correctly. Learn more: https://developers.google.com/maps/documentation/business/webservices/auth

我的方法是这样

 - (void) estimateETAWithWithOrigin:(CLLocationCoordinate2D)origin destination:(CLLocationCoordinate2D)destination onSuccess:(DirectionsCompletionBlock) completionBlock {


         NSString *baseUrl = [NSString stringWithFormat:@"%@?origin=%f,%f&destination=%f,%f&client=%@&signature=%@",
         GOOGLE_DIRECTIONS_API,
         origin.latitude,
         origin.longitude,
         destination.latitude,
         destination.longitude,
         CLIENTID,CRYPTO_KEY];
        baseUrl = [baseUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
        NSLog(@"%@",baseUrl);


.....

}

请帮助

您可以在开发人员文档中找到有关如何使用数字签名的信息。您甚至可以在那里测试自己的签名。 可以在google maps github repo上找到用于在Objective C中签署请求的代码

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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