void list_installed_apps(struct am_device *device) { connect_to_device(device); CFDictionaryRef apps; ASSERT_OR_EXIT(!AMDeviceLookupApplications(device, 0, &apps), "!AMDeviceLookupApplications\n"); CFDictionaryApplyFunction(apps, print_installed_app, NULL); CFRelease(apps); unregister_device_notification(0); }
CFURLRef copy_device_app_url(AMDeviceRef device, CFStringRef identifier) { CFDictionaryRef result; assert(AMDeviceLookupApplications(device, 0, &result) == 0); CFDictionaryRef app_dict = CFDictionaryGetValue(result, identifier); assert(app_dict != NULL); CFStringRef app_path = CFDictionaryGetValue(app_dict, CFSTR("Path")); assert(app_path != NULL); CFURLRef url = CFURLCreateWithFileSystemPath(NULL, app_path, kCFURLPOSIXPathStyle, true); CFRelease(result); return url; }