Commit 242cba30 authored by Fawzi Mohamed's avatar Fawzi Mohamed

ios: better error messages

Change-Id: I2ccb7655320b18eed9f10c8b6130befe8c9cbdb0
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@digia.com>
Reviewed-by: default avatarFawzi Mohamed <fawzi.mohamed@digia.com>
parent 7243def7
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <projectexplorer/buildconfiguration.h> #include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/projectexplorerconstants.h> #include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <qmakeprojectmanager/qmakebuildconfiguration.h> #include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakeproject.h> #include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakenodes.h> #include <qmakeprojectmanager/qmakenodes.h>
...@@ -97,6 +98,9 @@ void IosDeployStep::run(QFutureInterface<bool> &fi) ...@@ -97,6 +98,9 @@ void IosDeployStep::run(QFutureInterface<bool> &fi)
m_futureInterface = fi; m_futureInterface = fi;
QTC_CHECK(m_transferStatus == NoTransfer); QTC_CHECK(m_transferStatus == NoTransfer);
if (iosdevice().isNull()) { 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()); m_futureInterface.reportResult(!iossimulator().isNull());
cleanup(); cleanup();
m_futureInterface.reportFinished(); m_futureInterface.reportFinished();
...@@ -147,10 +151,14 @@ void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString ...@@ -147,10 +151,14 @@ void IosDeployStep::handleDidTransferApp(IosToolHandler *handler, const QString
{ {
Q_UNUSED(handler); Q_UNUSED(bundlePath); Q_UNUSED(deviceId); Q_UNUSED(handler); Q_UNUSED(bundlePath); Q_UNUSED(deviceId);
QTC_CHECK(m_transferStatus == TransferInProgress); QTC_CHECK(m_transferStatus == TransferInProgress);
if (status == IosToolHandler::Success) if (status == IosToolHandler::Success) {
m_transferStatus = TransferOk; m_transferStatus = TransferOk;
else } else {
m_transferStatus = TransferFailed; 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); m_futureInterface.reportResult(status == IosToolHandler::Success);
} }
...@@ -159,6 +167,8 @@ void IosDeployStep::handleFinished(IosToolHandler *handler) ...@@ -159,6 +167,8 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
switch (m_transferStatus) { switch (m_transferStatus) {
case TransferInProgress: case TransferInProgress:
m_transferStatus = TransferFailed; m_transferStatus = TransferFailed;
TaskHub::addTask(Task::Error, tr("Deployment failed."),
ProjectExplorer::Constants::TASK_CATEGORY_DEPLOYMENT);
m_futureInterface.reportResult(false); m_futureInterface.reportResult(false);
break; break;
case NoTransfer: case NoTransfer:
...@@ -175,6 +185,10 @@ void IosDeployStep::handleFinished(IosToolHandler *handler) ...@@ -175,6 +185,10 @@ void IosDeployStep::handleFinished(IosToolHandler *handler)
void IosDeployStep::handleErrorMsg(IosToolHandler *handler, const QString &msg) void IosDeployStep::handleErrorMsg(IosToolHandler *handler, const QString &msg)
{ {
Q_UNUSED(handler); 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); emit addOutput(msg, BuildStep::ErrorMessageOutput);
} }
...@@ -211,7 +225,7 @@ QString IosDeployStep::appBundle() const ...@@ -211,7 +225,7 @@ QString IosDeployStep::appBundle() const
void IosDeployStep::raiseError(const QString &errorString) void IosDeployStep::raiseError(const QString &errorString)
{ {
emit addTask(Task(Task::Error, errorString, Utils::FileName::fromString(QString()), -1, 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) void IosDeployStep::writeOutput(const QString &text, OutputFormat format)
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include <projectexplorer/devicesupport/deviceapplicationrunner.h> #include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/kitinformation.h> #include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <QDir> #include <QDir>
#include <QTime> #include <QTime>
...@@ -45,6 +47,8 @@ ...@@ -45,6 +47,8 @@
#include <signal.h> #include <signal.h>
using namespace ProjectExplorer;
namespace Ios { namespace Ios {
namespace Internal { namespace Internal {
...@@ -163,35 +167,17 @@ void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output) ...@@ -163,35 +167,17 @@ void IosRunner::handleAppOutput(IosToolHandler *handler, const QString &output)
emit appOutput(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) void IosRunner::handleErrorMsg(IosToolHandler *handler, const QString &msg)
{ {
Q_UNUSED(handler); Q_UNUSED(handler);
if (msg.contains(QLatin1String("AMDeviceStartService returned -402653150"))) if (msg.contains(QLatin1String("AMDeviceStartService returned -402653150")))
QTimer::singleShot(0, this, SLOT(warnAboutRunFail())); TaskHub::addTask(Task::Warning,
else if (msg.contains(QLatin1String("AMDeviceInstallApplication returned -402653103"))) tr("Run failed. The settings in the Organizer window of Xcode might be incorrect."),
QTimer::singleShot(0, this, SLOT(warnAboutDeployFail())); 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); emit errorMsg(msg);
} }
......
...@@ -70,8 +70,6 @@ signals: ...@@ -70,8 +70,6 @@ signals:
void errorMsg(const QString &msg); void errorMsg(const QString &msg);
void finished(bool cleanExit); void finished(bool cleanExit);
private slots: private slots:
void warnAboutRunFail();
void warnAboutDeployFail();
void handleDidStartApp(Ios::IosToolHandler *handler, const QString &bundlePath, void handleDidStartApp(Ios::IosToolHandler *handler, const QString &bundlePath,
const QString &deviceId, Ios::IosToolHandler::OpStatus status); const QString &deviceId, Ios::IosToolHandler::OpStatus status);
void handleGotGdbserverPort(Ios::IosToolHandler *handler, const QString &bundlePath, void handleGotGdbserverPort(Ios::IosToolHandler *handler, const QString &bundlePath,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment