如何在blackberry 10中为webview设置Cookie?

如何在blackberry 10中为webview设置Cookie?,webview,qml,blackberry-10,blackberry-cascades,Webview,Qml,Blackberry 10,Blackberry Cascades,有人能帮我在BB10的网络视图中设置cookies吗 下面是我的试用版,但不起作用 在qml中 WebView { id: webview horizontalAlignment: HorizontalAlignment.Center verticalAlignment: VerticalAlignment.Center preferredWidth: 700 set

有人能帮我在BB10的网络视图中设置cookies吗

下面是我的试用版,但不起作用

在qml中

     WebView {
            id: webview
            horizontalAlignment: HorizontalAlignment.Center
            verticalAlignment: VerticalAlignment.Center
            preferredWidth: 700
            settings.javaScriptEnabled: true
            settings.imageDownloadingEnabled: true
            settings.webInspectorEnabled: true
            url: constants.GET_BASEURL_Value() + subCatValue
            onCreationCompleted: {
                app.setWebCookies(webview, constants.GET_BASEURL_Value() + subCatValue);
            }
            preferredHeight: 1100
        }
在cpp中

    void ApplicationUI::setWebCookies(QObject* webObject, QString urlString) const {
    WebView* webview = qobject_cast<WebView*>(webObject);
    QUrl url = QUrl(urlString);
    WebCookieJar* m_pWebCookieJar = (webview->storage())->cookieJar();
    QSettings settings;
    QStringList cookies;
    cookies << "Cookie=" << settings.value("JSONID", "").toString().toUtf8();
    m_pWebCookieJar->setCookiesFromUrl(url, cookies);
    QStringList cookiesFromJar = m_pWebCookieJar->cookiesForUrl(url);

}
void ApplicationUI::setWebCookies(QObject*webObject,QString urlString)常量{
WebView*WebView=QoObject\u cast(webObject);
QUrl url=QUrl(url字符串);
WebCookieJar*m_pWebCookieJar=(webview->storage())->cookieJar();
QSettings设置;
小甜饼;
cookies cookiesForUrl(url);
}

您可以直接从QML进行设置:

webView.storage.cookieJar.setCookiesFromUrl(webView.url, ["test=test", "test1=test1"]);