API密钥未附加到ReverseGeocode请求。

huangapple go评论106阅读模式
英文:

API key not appending to ReverseGeocode request

问题

For some reason my API key doesn’t seem to be added to my reverse Geocode request.

API密钥似乎未添加到我的逆地理编码请求中。

The key is correctly in my info.plist , I’ve tried adding every other key to my plist also but this still isn’t working.

密钥已正确添加到我的info.plist中,我尝试将其他所有密钥也添加到我的plist中,但仍然无法正常工作。

Here is the request im attempting

这是我正在尝试的请求

var coordinate = CLLocationCoordinate2D()
coordinate.latitude = 54.966682
coordinate.longitude = -7.730234

let query = TTReverseGeocoderQueryBuilder.create(with: coordinate).withReturnSpeedLimit(true)
.build()
reverseGeocoder.reverseGeocoder(with: query)

Any help is greatly appreciated!

非常感谢任何帮助!

Thanks
Oliver

英文:

For some reason my API key doesn’t seem to be added to my reverse Geocode request.

API密钥未附加到ReverseGeocode请求。

The key is correctly in my info.plist , I’ve tried adding every other key to my plist also but this still isn’t working.

Here is the request im attempting

var coordinate = CLLocationCoordinate2D()
coordinate.latitude = 54.966682
coordinate.longitude = -7.730234

let query = TTReverseGeocoderQueryBuilder.create(with: coordinate).withReturnSpeedLimit(true)
    .build()
reverseGeocoder.reverseGeocoder(with: query)

Any help is greatly appreciated!

Thanks
Oliver

答案1

得分: 0

Everything looks fine. The API key is hidden inside logs.

Note that using reverseGeocoder(with: query) method you need to conform to the TTReverseGeocoderDelegate protocol in order to get the results out.
It can be easily done by adding a few lines of code:

import TomTomOnlineSDKSearch
import TomTomOnlineSDKRouting

class MainViewController: UIViewController, TTReverseGeocoderDelegate {
(...)
let tomtomRGeoAPI = TTReverseGeocoder()

func reverseGeocoder(_ reverseGeocoder: TTReverseGeocoder, completedWith response: TTReverseGeocoderResponse) {
    NSLog("成功")
}

func reverseGeocoder(_ reverseGeocoder: TTReverseGeocoder, failedWithError error: TTResponseError) {
    NSLog("错误")
}

override func viewDidLoad() {
    super.viewDidLoad()
    self.tomtomRevGeoAPI.delegate = self
    
    var coordinate = CLLocationCoordinate2D()
    coordinate.latitude = 54.966682
    coordinate.longitude = -7.730234

    let query = TTReverseGeocoderQueryBuilder.create(with: coordinate).withReturnSpeedLimit(true)
        .build()
    self.tomtomRevGeoAPI.reverseGeocoder(with: query)
}
(...)

祝好,
Mateusz

英文:

Everything looks fine. The API key is hidden inside logs.

Note that using reverseGeocoder(with: query) method you need to conform to the TTReverseGeocoderDelegate protocol in order to get the results out.
It can be easily done by adding a few lines of code:

import TomTomOnlineSDKSearch
import TomTomOnlineSDKRouting

class MainViewController: UIViewController, TTReverseGeocoderDelegate {
(...)
let tomtomRGeoAPI = TTReverseGeocoder()

func reverseGeocoder(_ reverseGeocoder: TTReverseGeocoder, completedWith response: TTReverseGeocoderResponse) {
    NSLog("success")
}

func reverseGeocoder(_ reverseGeocoder: TTReverseGeocoder, failedWithError error: TTResponseError) {
    NSLog("error")
}

override func viewDidLoad() {
    super.viewDidLoad()
    self.tomtomRevGeoAPI.delegate = self
    
    var coordinate = CLLocationCoordinate2D()
    coordinate.latitude = 54.966682
    coordinate.longitude = -7.730234

    let query = TTReverseGeocoderQueryBuilder.create(with: coordinate).withReturnSpeedLimit(true)
        .build()
    self.tomtomRevGeoAPI.reverseGeocoder(with: query)
}
(...)

Regards,
Mateusz

huangapple
  • 本文由 发表于 2020年1月6日 17:33:11
  • 转载请务必保留本文链接:https://go.coder-hub.com/59609640.html
  • tomtom
  • tomtom-android-sdk
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定