簡體   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