diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp index dcdd1fd612f..891e2300ec8 100644 --- a/src/tools/iostool/iosdevicemanager.cpp +++ b/src/tools/iostool/iosdevicemanager.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include @@ -104,6 +105,20 @@ static bool findXcodePath(QString *xcodePath) return (process.exitStatus() == QProcess::NormalExit && QFile::exists(*xcodePath)); } +static bool checkDevelopmentStatusViaDeviceCtl(const QString &deviceId) +{ + QProcess process; + process.start("/usr/bin/xcrun", QStringList({"devicectl", + "device", "info", "details", "--quiet", "--device", deviceId, "-j", "-"})); + if (!process.waitForFinished(3000)) { + qCWarning(loggingCategory) << "Failed to launch devicectl:" << process.errorString(); + return false; + } + + auto jsonOutput = QJsonDocument::fromJson(process.readAllStandardOutput()); + return jsonOutput["result"]["deviceProperties"]["developerModeStatus"] == "enabled"; +} + /*! * \brief Finds the \e DeveloperDiskImage.dmg path corresponding to \a versionStr and \a buildStr. * @@ -1668,13 +1683,20 @@ void DevInfoSession::deviceCallbackReturned() if (!failure) { res[deviceConnectedKey] = QLatin1String("YES"); res[deviceNameKey] = getStringValue(device, nullptr, CFSTR("DeviceName")); - res[developerStatusKey] = getStringValue(device, + res[uniqueDeviceId] = getStringValue(device, nullptr, CFSTR("UniqueDeviceID")); + const QString productVersion = getStringValue(device, nullptr, CFSTR("ProductVersion")); + + if (productVersion.startsWith("17.")) { + res[developerStatusKey] = checkDevelopmentStatusViaDeviceCtl(res[uniqueDeviceId]) + ? QLatin1String("Development") : QLatin1String("*off*"); + } else { + res[developerStatusKey] = getStringValue(device, CFSTR("com.apple.xcode.developerdomain"), CFSTR("DeveloperStatus"), "*off*"); + } + res[cpuArchitectureKey] = getStringValue(device, nullptr, CFSTR("CPUArchitecture")); - res[uniqueDeviceId] = getStringValue(device, nullptr, CFSTR("UniqueDeviceID")); - const QString productVersion = getStringValue(device, nullptr, CFSTR("ProductVersion")); const QString buildVersion = getStringValue(device, nullptr, CFSTR("BuildVersion")); if (!productVersion.isEmpty() && !buildVersion.isEmpty()) res[osVersionKey] = QString("%1 (%2)").arg(productVersion, buildVersion);