此处地图 Qt 应用程序 - 无法阅读此处/诺基亚地图版本。 - QGeoTileRequestManager:最后一个错误消息是:“主机需要身份验证”

问题描述 投票:0回答:1

当使用我想在 qt 应用程序中使用的此处地图时,出现此错误并且屏幕不出现。我该如何解决它

enter image description here enter image description here

我的 QML 代码

import QtQuick 2.15
    import QtQuick.Controls 2.15
    import QtQuick.Window 2.15
    // Here Maps import
    import QtLocation 5.15
    import QtPositioning 5.15
    
    Window {
        visible: true
        width: 640
        height: 480
        title: qsTr("Here Maps Example")
    
    
    
        Plugin {
            id: hereMaps
            name: "here"
    
            // Your HERE API key
    
            PluginParameter {
                name: "here.app_id"
                value: "e--------------tU"
            }
    
            PluginParameter {
                name: "here.token"
                value: "KS---------------0w"
            }
        }
    
        Map {
            anchors.fill: parent
            plugin: hereMaps
            center: QtPositioning.coordinate(38.4501, 27.1777)
            zoomLevel: 14
        }
    }

我的错误

QML debugging is enabled. Only use this in a safe environment.
No proxy parameter specified.
Failed to read here/nokia map version.
    QGeoTileRequestManager: Failed to fetch tile (9430,6293,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9430,6292,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9429,6292,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9427,6293,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9429,6293,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9428,6292,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9429,6294,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9427,6294,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9430,6294,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9428,6293,14) 5 times, giving up. Last error message was: 'Host requires authentication'
QGeoTileRequestManager: Failed to fetch tile (9427,6292,14) 5 times, giving up. Last error message was: 'Host requires authentication'

以这种方式

https://maps.hereapi.com/v3/base/mc/11/1100/672/jpeg?style=satellite.day&apiKey={My api key}
当我尝试拍摄图像时,我可以获得图像,并且可以在我的qt应用程序中将其显示为图像,但它需要有一个动态地图。

c++ qt location maps heremaps
1个回答
0
投票

看起来5.15.2版本的QtPositioning将令牌和应用程序ID作为查询参数传递

    if (!m_token.isEmpty() && !m_applicationId.isEmpty()) { // TODO: remove the if
        requestString += "?token=";
        requestString += m_token;

        requestString += "&app_id=";
        requestString += m_applicationId;
    }

我在 HERE API 文档上找到的所有身份验证方法都需要标头中的令牌:

Authorization: Bearer <token>

您必须修改代码才能执行此操作。

© www.soinside.com 2019 - 2024. All rights reserved.