Fix an issue introduced by #503 where installing an IPA requires explicitly providing a bundle id. The bundle id is used to determine the final install location so it can be printed but is not otherwise required. (#569)
diff --git a/src/ios-deploy/ios-deploy.m b/src/ios-deploy/ios-deploy.m
index ea9fdd9..bae9f43 100644
--- a/src/ios-deploy/ios-deploy.m
+++ b/src/ios-deploy/ios-deploy.m
@@ -2733,16 +2733,7 @@
NSLogOut(@"------ Install phase ------");
NSLogOut(@"[ 0%%] Found %@ connected through %@, beginning install", device_full_name, device_interface_name);
- CFStringRef install_bundle_id = NULL;
- if (bundle_id != NULL) {
- install_bundle_id = CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
- } else {
- CFStringRef extracted_bundle_id = copy_bundle_id(url);
- if (extracted_bundle_id == NULL) {
- on_error(@"[ ERROR] Could not determine bundle id.");
- }
- install_bundle_id = extracted_bundle_id;
- }
+ CFStringRef install_bundle_id = bundle_id == NULL ? copy_bundle_id(url) : CFStringCreateWithCString(NULL, bundle_id, kCFStringEncodingUTF8);
CFDictionaryRef options;
if (app_deltas == NULL) { // standard install
@@ -2756,6 +2747,9 @@
check_error(AMDeviceStopSession(device));
check_error(AMDeviceDisconnect(device));
} else { // incremental install
+ if (install_bundle_id == NULL) {
+ on_error(@"[ ERROR] Could not determine bundle id.");
+ }
CFStringRef deltas_path =
CFStringCreateWithCString(NULL, app_deltas, kCFStringEncodingUTF8);
CFURLRef deltas_relative_url =
@@ -2797,24 +2791,32 @@
CFRelease(options);
- connect_and_start_session(device);
- CFURLRef device_app_url = copy_device_app_url(device, install_bundle_id);
- check_error(AMDeviceStopSession(device));
- check_error(AMDeviceDisconnect(device));
- CFStringRef device_app_path = CFURLCopyFileSystemPath(device_app_url, kCFURLPOSIXPathStyle);
-
NSLogOut(@"[100%%] Installed package %@", [NSString stringWithUTF8String:app_path]);
- NSLogVerbose(@"App path: %@", device_app_path);
- NSLogJSON(@{@"Event": @"BundleInstall",
- @"OverallPercent": @(100),
- @"Percent": @(100),
- @"Status": @"Complete",
- @"Path": (__bridge NSString *)device_app_path
- });
+ if (install_bundle_id == NULL) {
+ NSLogJSON(@{@"Event": @"BundleInstall",
+ @"OverallPercent": @(100),
+ @"Percent": @(100),
+ @"Status": @"Complete"
+ });
+ } else {
+ connect_and_start_session(device);
+ CFURLRef device_app_url = copy_device_app_url(device, install_bundle_id);
+ check_error(AMDeviceStopSession(device));
+ check_error(AMDeviceDisconnect(device));
+ CFStringRef device_app_path = CFURLCopyFileSystemPath(device_app_url, kCFURLPOSIXPathStyle);
+
+ NSLogVerbose(@"App path: %@", device_app_path);
+ NSLogJSON(@{@"Event": @"BundleInstall",
+ @"OverallPercent": @(100),
+ @"Percent": @(100),
+ @"Status": @"Complete",
+ @"Path": (__bridge NSString *)device_app_path
+ });
- CFRelease(device_app_url);
- CFRelease(install_bundle_id);
- CFRelease(device_app_path);
+ CFRelease(device_app_url);
+ CFRelease(install_bundle_id);
+ CFRelease(device_app_path);
+ }
}
CFRelease(path);