我正在尝试为 Ubuntu Touch 开发原生 QML 应用程序,但是当需要从我的服务器获取远程内容来填充列表视图时,它会因 apparmor 拒绝而失败。
这是我用来填充 UbuntuListView 的 ListModel。ListModel 有一个名为 fetchposts() 的函数,该函数迭代执行 XmlHttpRequest 以获取帖子的评论和标签列表。
ListModel {
id: postsModel
function fetchposts() {
postsModel.clear() // empty our list view
var http = new XMLHttpRequest();
http.open("GET", server + "/postnum", true)
http.send(null)
var postnum = http.responseText
/* repopulate list view */
for (var i = 1; i <= postnum; i++) {
http.open("GET", server + "/p/" + i + ".txt", true)
http.send(null)
var postComment = http.responseText
http.open("GET", server + "/p/" + i + "_werc/tags", true)
http.send(null)
var postTags = http.responseText
postsModel.append({"comment":postComment, "tags":postTags})
}
}
}
但是当我postsModel.fetchposts()
稍后调用时,出现以下错误:
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) propsReply "An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.1827" (uid=32011 pid=28754 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene Toku") interface="org.freedesktop.DBus.Properties" member="GetAll" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=1592 comm="NetworkManager ")"
QNetworkManagerInterface::QNetworkManagerInterface(QObject*) nmReply "An AppArmor policy prevents this sender from sending this message to this recipient; type="method_call", sender=":1.1827" (uid=32011 pid=28754 comm="/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene Toku") interface="org.freedesktop.NetworkManager" member="GetDevices" error name="(unset)" requested_reply="0" destination="org.freedesktop.NetworkManager" (uid=0 pid=1592 comm="NetworkManager ")"
"Object path cannot be empty"
这是我的 apparmor 文件:
{
"policy_groups": [
"networking",
"webview",
"connectivity",
"content_exchange",
"content_exchange_source",
],
"policy_version": 1.3
}
我发出的这些请求是否错误?如何发出 http 请求而不会遭到 apparmor 拒绝?
如果有人能给我指明正确的方向,我将不胜感激。