我的目标是运行php脚本并获取返回的值。我在Neccesitas SDK(Qt for Android)下工作要做到这一点我做:
m_NetworkAccessMNGR = new QNetworkAccessManager(this);
QEventLoop loop;
QNetworkReply* m_reply = m_NetworkAccessMNGR->get(QNetworkRequest(url));
connect(m_reply, SIGNAL(finished()),
this, SLOT(slothttpFinished()));
connect(m_reply, SIGNAL(readyRead()),
this, SLOT(slothttpReadyRead()));
connect(m_reply, SIGNAL(finished()), &loop, SLOT(quit()));
loop.exec();
仅在Android上我得到了这个:: slothttpReadyRead
m_reply->error() is QNetworkReply::HostNotFoundError
和m_reply-> errorString()输出:
错误:未找到主机www.google.com
在Windows上,这非常有效。
我应该对Android进行一些调整吗?也许AndroidManifest.xml需要进行一些设置?
我的AndroidManifest.xml包含以下内容:
uses-permission android:name =“android.permission.INTERNET”/>
uses-permission android:name =“android.permission.WRITE_EXTERNAL_STORAGE”/>
谢谢