diff --git a/src/tools/iostool/iosdevicemanager.cpp b/src/tools/iostool/iosdevicemanager.cpp index 46a25dc8b17b3790a3fd9dbe27daa77ef67ec052..953fc1824e3a71491756bb7d8518132e4a8fd615 100644 --- a/src/tools/iostool/iosdevicemanager.cpp +++ b/src/tools/iostool/iosdevicemanager.cpp @@ -125,7 +125,7 @@ typedef am_res_t (MDEV_API *AMDeviceInstallApplicationPtr)(ServiceSocket, CFStri typedef am_res_t (MDEV_API *AMDeviceUninstallApplicationPtr)(ServiceSocket, CFStringRef, CFDictionaryRef, AMDeviceInstallApplicationCallback, void*); -typedef am_res_t (MDEV_API *AMDeviceLookupApplicationsPtr)(AMDeviceRef, unsigned int, CFDictionaryRef *); +typedef am_res_t (MDEV_API *AMDeviceLookupApplicationsPtr)(AMDeviceRef, CFDictionaryRef, CFDictionaryRef *); } // extern C QString CFStringRef2QString(CFStringRef s) @@ -204,7 +204,7 @@ public : am_res_t deviceUninstallApplication(int, CFStringRef, CFDictionaryRef, AMDeviceInstallApplicationCallback, void*); - am_res_t deviceLookupApplications(AMDeviceRef, unsigned int, CFDictionaryRef *); + am_res_t deviceLookupApplications(AMDeviceRef, CFDictionaryRef, CFDictionaryRef *); void addError(const QString &msg); void addError(const char *msg); @@ -1151,10 +1151,21 @@ QString AppOpSession::appPathOnDevice() if (!connectDevice()) return QString(); CFDictionaryRef apps; - if (int err = lib()->deviceLookupApplications(device, 0, &apps)) { + CFDictionaryRef options; + const void *attributes[3] = { (const void*)(CFSTR("CFBundleIdentifier")), + (const void*)(CFSTR("Path")), (const void*)(CFSTR("CFBundleExecutable")) }; + CFArrayRef lookupKeys = CFArrayCreate(kCFAllocatorDefault, (const void**)(&attributes[0]), 3, + &kCFTypeArrayCallBacks); + CFStringRef attrKey = CFSTR("ReturnAttributes"); + options = CFDictionaryCreate(kCFAllocatorDefault, (const void**)(&attrKey), + (const void**)(&lookupKeys), 1, + &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + CFRelease(lookupKeys); + if (int err = lib()->deviceLookupApplications(device, options, &apps)) { addError(QString::fromLatin1("app lookup failed, AMDeviceLookupApplications returned %1") .arg(err)); } + CFRelease(options); if (debugAll) CFShow(apps); if (apps && CFGetTypeID(apps) == CFDictionaryGetTypeID()) { @@ -1509,11 +1520,11 @@ am_res_t MobileDeviceLib::deviceUninstallApplication(int serviceFd, CFStringRef return -1; } -am_res_t MobileDeviceLib::deviceLookupApplications(AMDeviceRef device, unsigned int i, +am_res_t MobileDeviceLib::deviceLookupApplications(AMDeviceRef device, CFDictionaryRef options, CFDictionaryRef *res) { if (m_AMDeviceLookupApplications) - return m_AMDeviceLookupApplications(device, i, res); + return m_AMDeviceLookupApplications(device, options, res); return -1; } diff --git a/src/tools/iostool/main.cpp b/src/tools/iostool/main.cpp index 36cc9dba7776492075533794fa9da2893244ce06..323e31c79abf44727f707d449ee394b917454f8f 100644 --- a/src/tools/iostool/main.cpp +++ b/src/tools/iostool/main.cpp @@ -106,7 +106,7 @@ IosTool::IosTool(QObject *parent): ipv6(false), inAppOutput(false), splitAppOutput(true), - appOp(Ios::IosDeviceManager::Install), + appOp(Ios::IosDeviceManager::None), outFile(), out(&outFile), gdbFileDescriptor(-1), @@ -281,7 +281,7 @@ void IosTool::didTransferApp(const QString &bundlePath, const QString &deviceId, //out.writeCharacters(QString()); // trigger a complete closing of the empty element outFile.flush(); if (status != Ios::IosDeviceManager::Success || --opLeft == 0) - doExit(-1); + doExit((status == Ios::IosDeviceManager::Success) ? 0 : -1); } void IosTool::didStartApp(const QString &bundlePath, const QString &deviceId,