forked from qt-creator/qt-creator
ios: better error messages
Change-Id: I2ccb7655320b18eed9f10c8b6130befe8c9cbdb0 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@digia.com> Reviewed-by: Fawzi Mohamed <fawzi.mohamed@digia.com>
This commit is contained in:
@@ -39,6 +39,7 @@
|
||||
#include <projectexplorer/buildconfiguration.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <qmakeprojectmanager/qmakebuildconfiguration.h>
|
||||
#include <qmakeprojectmanager/qmakeproject.h>
|
||||
#include <qmakeprojectmanager/qmakenodes.h>
|
||||
@@ -97,6 +98,9 @@ void IosDeployStep::run(QFutureInterface<bool> &fi)
|
||||
m_futureInterface = fi;
|
||||
QTC_CHECK(m_transferStatus == NoTransfer);
|
||||
if (iosdevice().isNull()) {
|
||||
if (iossimulator().isNull())
|
||||
TaskHub::addTask(Task::Error, tr("Deployment failed. No iOS device found."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
m_futureInterface.reportResult(!iossimulator().isNull());
|
||||
cleanup();
|
||||
m_futureInterface.reportFinished();
|
||||
@@ -147,10 +151,14 @@ void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString
|
||||
{
|
||||
Q_UNUSED(handler); Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
|
||||
QTC_CHECK(m_transferStatus == TransferInProgress);
|
||||
if (status == IosToolHandler::Success)
|
||||
if (status == IosToolHandler::Success) {
|
||||
m_transferStatus = TransferOk;
|
||||
else
|
||||
} else {
|
||||
m_transferStatus = TransferFailed;
|
||||
TaskHub::addTask(Task::Error,
|
||||
tr("Deployment failed. The settings in the Organizer window of Xcode might be incorrect."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
}
|
||||
m_futureInterface.reportResult(status == IosToolHandler::Success);
|
||||
}
|
||||
|
||||
@@ -159,6 +167,8 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
|
||||
switch (m_transferStatus) {
|
||||
case TransferInProgress:
|
||||
m_transferStatus = TransferFailed;
|
||||
TaskHub::addTask(Task::Error, tr("Deployment failed."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
m_futureInterface.reportResult(false);
|
||||
break;
|
||||
case NoTransfer:
|
||||
@@ -175,6 +185,10 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
|
||||
void IosDeployStep::handleErrorMsg(IosToolHandler *handler, const QString &msg)
|
||||
{
|
||||
Q_UNUSED(handler);
|
||||
if (msg.contains(QLatin1String("AMDeviceInstallApplication returned -402653103")))
|
||||
TaskHub::addTask(Task::Warning,
|
||||
tr("The Info.plist might be incorrect."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
emit addOutput(msg, BuildStep::ErrorMessageOutput);
|
||||
}
|
||||
|
||||
@@ -211,7 +225,7 @@ QString IosDeployStep::appBundle() const
|
||||
void IosDeployStep::raiseError(const QString &errorString)
|
||||
{
|
||||
emit addTask(Task(Task::Error, errorString, Utils::FileName::fromString(QString()), -1,
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT));
|
||||
}
|
||||
|
||||
void IosDeployStep::writeOutput(const QString &text, OutputFormat format)
|
||||
|
||||
@@ -38,6 +38,8 @@
|
||||
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <projectexplorer/target.h>
|
||||
#include <projectexplorer/taskhub.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QTime>
|
||||
@@ -45,6 +47,8 @@
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
@@ -163,35 +167,17 @@ void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output)
|
||||
emit appOutput(output);
|
||||
}
|
||||
|
||||
void IosRunner::warnAboutRunFail()
|
||||
{
|
||||
QMessageBox mBox;
|
||||
mBox.setText(tr("Running on iOS device failed."));
|
||||
mBox.setInformativeText(tr("The certificates in Xcode or the device might be outdated. Check the certificates in the organizer window of Xcode, and try again."));
|
||||
mBox.setStandardButtons(QMessageBox::Ok);
|
||||
mBox.setDefaultButton(QMessageBox::Ok);
|
||||
mBox.setIcon(QMessageBox::Information);
|
||||
mBox.exec();
|
||||
}
|
||||
|
||||
void IosRunner::warnAboutDeployFail()
|
||||
{
|
||||
QMessageBox mBox;
|
||||
mBox.setText(tr("Deploying to iOS device failed."));
|
||||
mBox.setInformativeText(tr("This might be due to an incorrect Info.plist or outdated certificates in Xcode or device (see organizer window of Xcode)."));
|
||||
mBox.setStandardButtons(QMessageBox::Ok);
|
||||
mBox.setDefaultButton(QMessageBox::Ok);
|
||||
mBox.setIcon(QMessageBox::Information);
|
||||
mBox.exec();
|
||||
}
|
||||
|
||||
void IosRunner::handleErrorMsg(IosToolHandler *handler, const QString &msg)
|
||||
{
|
||||
Q_UNUSED(handler);
|
||||
if (msg.contains(QLatin1String("AMDeviceStartService returned -402653150")))
|
||||
QTimer::singleShot(0, this, SLOT(warnAboutRunFail()));
|
||||
else if (msg.contains(QLatin1String("AMDeviceInstallApplication returned -402653103")))
|
||||
QTimer::singleShot(0, this, SLOT(warnAboutDeployFail()));
|
||||
TaskHub::addTask(Task::Warning,
|
||||
tr("Run failed. The settings in the Organizer window of Xcode might be incorrect."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
else if (msg.contains(QLatin1String("Unexpected reply: ELocked (454c6f636b6564) vs OK (OK)")))
|
||||
TaskHub::addTask(Task::Error,
|
||||
tr("The device is locked, please unlock."),
|
||||
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
|
||||
emit errorMsg(msg);
|
||||
}
|
||||
|
||||
|
||||
@@ -70,8 +70,6 @@ signals:
|
||||
void errorMsg(const QString &msg);
|
||||
void finished(bool cleanExit);
|
||||
private slots:
|
||||
void warnAboutRunFail();
|
||||
void warnAboutDeployFail();
|
||||
void handleDidStartApp(Ios::IosToolHandler *handler, const QString &bundlePath,
|
||||
const QString &deviceId, Ios::IosToolHandler::OpStatus status);
|
||||
void handleGotGdbserverPort(Ios::IosToolHandler *handler, const QString &bundlePath,
|
||||
|
||||
Reference in New Issue
Block a user