英文:
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.
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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论